API Exemplos: Twitter, Facebook, Google Maps..
Rest - http
- POST -> Create
- GET -> Retrieve
- PUT -> Update
- DELETE -> Delete
Status Code HTTP Status Cat
- 200 - Ok
- 404 - Not Found
- 201 - Created
- MongoDB
$ brew install mongodb
- MySQL
$ brew install mysql
- bluebird (para Promises)
- expressjs (como framework de rotas)
- mongojs (conector para o mongodb)
- supertest
- mocha (testes unitários)
Instale o nodemon global e as dependências locais do projeto:
$ npm install -g nodemon
$ npm install
$ npm start
Para rodar os testes
$ npm test
$ curl -H "Content-Type: application/json" \
-d '{"name":"Jane Doe"}' http://localhost:3000/products
$ curl -H "Content-Type: application/json" \
http://localhost:3000/products
$ curl -H "Content-Type: application/json" \
http://localhost:3000/products/55060ceba8cf25db09f3b216
$ curl -H "Content-Type: application/json" \
-H "X-HTTP-Method-Override: PUT" -d '{"name":"Foo Bar"}' \
http://localhost:3000/products/55061dc648ccdc491c6b2b61
$ curl -X POST -H "Content-Type: application/json" \
-H "X-HTTP-Method-Override: DELETE" \
http://localhost:3000/products/55061dc648ccdc491c6b2b61