Skip to main content

backend-development-basics

SOURCE: https://scrimba.com/s05e8338en - The Network Tool and Related Concepts

Client Server

Client

  • what the users interact with directly
  • part of a web application that users interact with directly ex: browser, mobile app, smart watch

Server

  • processes request from client
  • a remote machine which handles data and sends back information or content to the client in response to requests.

Rest API

  • allows a client to talk to a server to get access to (and possibly edit or add to) some data stored remotely ex: weather data, currency exchange rates, stock prices

Methods

POST - create GET - read DELETE - delete

*not being used frequently PUT - replace PATCH - update

difference of PUT and PATCH: for example this is your data:

{
"name": "john"
"email": "john@mail.com"
"country": "philippines"
}

if you PUT country: denmark new data will be:

"country": "denmark"

if you PATCH country: denmark new data will be:

{
"name": "john"
"email": "john@mail.com"
"country": "denmark"
}

PUT replaces the entire resource PATCH replaces parts of the source resource with the values provided

Endpoints

  • specific URL in an API that represents a resource or action ex: http://localhost:800/api/js/libraries

Codes

200 - OK 400 - Bad Request 404 - Not Found 500 - Server error

Content-Types (Mime types)

  • application/json
  • text/html
  • text/css
  • application/javascript
  • application/xml
    • many more

Any data that is being sent or received needs to be parsed. Specifying the content type helps client and server do that. Failure to do that could cause bugs.