Giter VIP home page Giter VIP logo

rdbms-api-full's Introduction

Building and API using a Relational Database

Topics

  • Databases
  • Relational Databases
  • Knex mirations.
  • Seeding data.

Assignment

Build an API that persists data to SQLite3.

Use knex migrations to create a database called lambda.sqlite3 and add the following tables:

cohorts

  • id: primary key, autoincrements.
  • name: text, required.

students

  • id: primary key, autoincrements.
  • name: text, required.
  • cohort_id: references the id in the cohorts table.

Use knex seeding feature to add test data to your tables.

Implement the following endpoints:

  • [POST] /api/cohorts This route should save a new cohort to the database.
  • [GET] /api/cohorts This route will return an array of all cohorts.
  • [GET] /api/cohorts/:id This route will return the cohort with the matching id.
  • [GET] /api/cohorts/:id/students returns all students for the cohort with the specified id.
  • [PUT] /api/cohorts/:id This route will update the cohort with the matching id using information sent in the body of the request.
  • [DELETE] /api/cohorts/:id This route should delete the specified cohort.

Stretch Problem

Add the following endpoints.

  • [POST] /students This route should save a new student to the database.
  • [GET] /students This route will return an array of all students.
  • [GET] /students/:id This route will return the student with the matching id.
  • [PUT] /students/:id This route will update the student with the matching id using information sent in the body of the request.
  • [DELETE] /students/:id This route should delete the specified student.

Have the student returned by the [GET] /students/:id endpoint include the cohort name and remove the cohort_id fields. The returned object should look like this:

{
  id: 1,
  name: 'Lambda Student',
  cohort: 'Full Stack Web Infinity'
}

rdbms-api-full's People

Contributors

luishrd avatar gooseandmegander avatar

Watchers

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