GithubHelp home page GithubHelp logo

deepcloud / ecomapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pixelhandler/ecomapi

1.0 1.0 0.0 339 KB

See Post at: http://pixelhandler.com/blog/2012/02/09/develop-a-restful-api-using-node-js-with-express-and-mongoose/

Home Page: http://ecomapi.herokuapp.com/#list

ecomapi's Introduction

Build a RESTful api using node - ecommerce example

API for ecommerce application

Design

  • Simple API design and pragmatic REST - only 2 base URLs per resource
  • Keep verbs out of your base URLs
  • Our HTTP verbs are POST, GET, PUT, and DELETE (CRUD - Create, Read, Update, Delete)
  • Concrete names are better than abstract

Example : two resources (/products and /products/1) and the four HTTP verbs

Resource Post
(create)
Get
(read)
Put
(update)
Delete
(delete)
/products create a new product list products bulk update products delete all products
/products/1234 error show 1234 if exists update 1234, else error delete 1234

Nouns

Products

Product:

Id,  
Title,  
Description,  
Image URL,  
Categories: [ { Name } ],  
Style Number,  
Colors: [  
  {  
    Name,  
    Images: [  
      { Size, URL }  
    ],  
    Sizes: [  
      { Size, Available, SKU, Price }  
    ],  
  }  
]

Urls:

  • /products - list
  • /products/:id - single

Data: MongoDB using Mongoose with Express framework running with Node.js

Models are defined by passing a Schema instance to mongoose.model.

References

ecomapi's People

Stargazers

Fang Yang 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.