Git Product home page Git Product logo

api-architecture's Introduction

api-architecture

  1. RESTful Architecture

** 7 RESTful Routes **

BOOK Model

  • VIEWS ROUTES * GET /book -> Handlebars or HTML (View all books) GET /book/:id -> Handlebars or HTML (View a single book with that id) GET /book/edit/:id -> Handlebars or HTML (View a Book form, pre-populated with data. ) GET /book/new -> Handlebars or HTML (View a Book form, empty)

  • API ROUTES * POST /book -> JSON (Creates a new book in the DB) PUT /book/:id -> JSON (Update an existing book, by ID) DELETE /book/:id -> JSON (Delete an existing book, by ID)

BOOK Model + AUTHOR model

  • VIEWS ROUTES * GET /book -> Handlebars or HTML (View all books, include associated authors) GET /book/:id -> Handlebars or HTML (View a single book with that id with associated author) GET /book/edit/:id -> Handlebars or HTML (View a Book form, pre-populated with data. Can I edit author at same time?) GET /book/new -> Handlebars or HTML (View a Book form, empty, maybe with dropdown to Select existing author)

  • API ROUTES * POST /book -> JSON (Creates a new book in the DB) PUT /book/:id -> JSON (Update an existing book, by ID, and maybe corresponding author?) DELETE /book/:id -> JSON (Delete an existing book, by ID)

  1. Resource-driven APIs

Resource = A single item in a database table (single row, single document, single object) Collection = Multiple items from a database table (multiple rows, multiple documents, array of objects)

  • API ROUTES *

BOOK Model

GET /book -> JSON (Returns a collection of books from the DB) GET /book/:id -> JSON (Returns a single book resource from the DB by ID) POST /book -> JSON (Creates a single book resource in the DB) PUT /book/:id -> JSON (Updates a single book resource in the DB by ID) DELETE /book/:id -> JSON (Removes a single book resource in the DB by ID)

To create a Book, with an authorId as a foreign key, what must I have FIRST?

I MUST have an author. I MUST have that author's id.

api-architecture's People

Contributors

jonathanjwatson avatar

Stargazers

 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.