Giter VIP home page Giter VIP logo

08-intro-to-sinatra's Introduction

Intro to Sinatra

Lecture Deliverables:

  • 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.

Lecture Take Aways:

  • Request-response cycle
  • HTTP methods
  • APIs
  • Active Record
  • Rack
  • Sinatra
  • Routes
  • Params
  • Strong params
  • Dynamic Routing

What is the internet?

  • A combination of communication between the server and client side

Alt text

Request/Response flow:

  1. User types in URL into the browser(client)
  2. Server receives the request, processes it and provides a response
  3. Response is rendered on client side

HTTP:

  • 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

How do we know where to send the request? Hello, URL's

  • Short for Uniform Resource Locators

Let's break it down:

http://localhost:9292/starships
  1. http - the protocol
  2. localhost:9292 - the domain(for now)
  3. /starships - the endpoint

CRUD and HTTP Verbs

  • 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:

Alt text

Status Codes:

Alt text

Sinatra

  • 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

RESTful Routing:

  • GET /starships
  • GET /starships/:id
  • POST /starships
  • PATCH /starships/:id
  • DELETE /starships/:id

08-intro-to-sinatra's People

Contributors

aisayo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.