Git Product home page Git Product logo

diy-api's Introduction

DIY API โ€” Homework

Deliverable:

It's time to make your own API!

Using what you have learned about Express, Express Routing, RESTful routing, CRUD operations, and Sequelize, use the Sequelize ORM to implement full CRUD functionality on a model (subject of your choosing).


Requirements:

  1. The model you choose to use should have at least three fields, as well an id field.

Example:

column name type
id integer
createdAt timestamp
updatedAt timestamp
name text
wodgets integer
quantity integer
  1. Your API should be accessible via five routes:

Example:

Method Action URL Functionality
GET index /widgets list all widgets
POST create /widgets add a widget
GET detail/show /widgets/:id show one widget
PUT update /widgets/:id update one widget
DELETE delete /widgets/:id delete one widget

Steps to Achieve

You will need to:

  1. Fork and clone this repository!
  2. Run npm init to start your node project.
  3. Create a .gitignore and add everything to ignore
  4. Create your Express App
  5. Sequelize init

Recommended Workflow:

  1. Stub out your routes, write them res.send("test") for initial decleration.
  2. Declare your model and migrate.
  3. Link your model to your server.
  4. Update your routes and make the magic happen!

Bonus:

Add a second model to your API. This model should relate to your first model via a 1:M relationship.

Once added, update your GET and POST routes for this second model which allow you do the following with your API:

  1. Show all elements from second model that relate to your element from first model at :id.
  2. Add a new element to your original model that include related elements from this second model at :id.

diy-api's People

Contributors

nhvattum avatar 009kings avatar azocher 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.