Node REST API
NodeAPI
is REST API server implementation built on top Node.js
and Express.js
with Sequalize.js
for Postrgesql
integration. Access control follows OAuth 2.0
spec with the help of OAuth2orize
and Passport.js
.
This is updated code that follows RESTful API With Node.js + MongoDB article.
Running project
Manual
You need to have Node.js installed.
Run server
npm start
# alias for
node bin/www
Docker
You need to have Docker installed.
Run server
docker-compose up -d --build
Make Requests
Create and refresh access tokens:
http POST http://localhost:1337/api/oauth/token grant_type=password client_id=chrome-ext client_secret=aJhjsdjl13gh7 username=admin password=1admin!
http POST http://localhost:1337/api/oauth/token grant_type=refresh_token client_id=chrome-ext client_secret=aJhjsdjl13gh7 refresh_token=[REFRESH_TOKEN]
Get your data:
http http://localhost:1337/api/users/info Authorization:'Bearer ACCESS_TOKEN'
Tests
npm test
# alias for
node ./test/server.test.js
Modules used
Some of non-standard modules used:
Test modules:
Tools used
- httpie - command line HTTP client
Author
Created and maintained by Evgeny Aleksandrov (@ealeksandrov).
Updated by:
- Istock Jared
- Marko Arsić
- and other contributors
License
NodeAPI
is available under the MIT license. See the LICENSE.md file for more info.