Giter Site home page Giter Site logo

restful-api-example's Introduction

Full Stack API

Today we are going to build a full-stack API from scratch.

Description

We will be building an API that can manage evening courses, participants, and faculty at UW. That means we should be able to:

  • Create new courses
  • Create and assign students to a course
  • Create and assign faculty to a course

Data & Fields

We will want to be able to capture the following information:

Courses

  • Name of the course
  • Start Date for the course
  • End Date for the course
  • Location including building address and room number

Students

  • First and last name
  • Preferred name or nickname
  • Email address

Faculty

  • First and last name
  • Preferred name or nickname
  • Email address
  • Role

Features

In addition to basic CRUD operations, we will also want to be able to:

  • Provide an endpoint for a course that returns a random student to call on during class
  • GET /courses/:id/students/random
    • Math.random()
  • Provide an endpoint that will mark attendance for a student for a specified date
  • PATCH /students/:id

CRUD "RESTful" API Design It's more than just CRUD. We want to make the correct requests based off of actions and return the correct responses with status codes.

GET ALL - GET - /books - 200 Convention is you use a plural name here.

GET ONE - GET - /books/:id - 200 Convention is to use some unique identifier. //* CAN'T FIND IT - 404

CREATE - POST - /books - 201 //* VALIDATION ERROR - 400/422

UPDATE - PUT/PATCH - /books/:id - 200 //* Put - you are replacing the entire thing //* Patch - you are replacing only a part...only one or more valid fields. //* CAN'T FIND IT - 404 //* VALIDATION ERROR - 400/422

DESTROY - DELETE - /books/:id - 200 //* CAN'T FIND IT - 404

restful-api-example's People

Contributors

tworkman512 avatar

Watchers

James Cloos 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.