- Create a web API server that can receive requests from a frontend application, such as React, and send back a JSON response that takes data from the database using your Active Record models.
- Create a GET request that will respond with all starships.
- Create a POST request that allows submission of a new starship.
- Request-response cycle
- HTTP methods
- APIs
- Active Record
- Rack
- Sinatra
- Routes
- Params
- Strong params
- Dynamic Routing
- A combination of communication between the server and client side
- User types in URL into the browser(client)
- Server receives the request, processes it and provides a response
- Response is rendered on client side
- Short for Hyper Text Transfer Protocol
- HTTP is a protocol(guideline) used for client to server side communication and loading a website. Can also use HTTPS for a more secure communication
- Short for Uniform Resource Locators
Let's break it down:
http://localhost:9292/starships
http
- the protocollocalhost:9292
- the domain(for now)/starships
- the endpoint
- By default, the above request will make a
GET
request, but what happens when we want to make a different type of request?
Let's look at HTTP Verbs:
- A light weight framework used to build full stack web applications or provide an API
- Built with Ruby
- Uses Rack under the hood
- Good introduction to Rails
GET /starships
GET /starships/:id
POST /starships
PATCH /starships/:id
DELETE /starships/:id