All Projects → ealeksandrov → Nodeapi

ealeksandrov / Nodeapi

Licence: mit
Simple RESTful API implementation on Node.js + MongoDB.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Nodeapi

Spruce
A social networking platform made using Node.js and MongoDB
Stars: ✭ 399 (-44.51%)
Mutual labels:  api, mongodb, express
Blog Service
blog service @nestjs
Stars: ✭ 188 (-73.85%)
Mutual labels:  api, mongodb, express
Node Express Mongoose Passport Jwt Rest Api Auth
Node, express, mongoose, passport and JWT REST API authentication example
Stars: ✭ 146 (-79.69%)
Mutual labels:  api, restful, express
Es6 Express Mongoose Passport Rest Api
Lightweight boilerplate for Node RESTful API, ES6, Express, Mongoose and Passport 🎁
Stars: ✭ 36 (-94.99%)
Mutual labels:  api, restful, express
Jianshu
仿简书nx+nodejs+nestjs6+express+mongodb+angular8+爬虫
Stars: ✭ 296 (-58.83%)
Mutual labels:  api, mongodb, express
Aclify
🔒 Node Access Control Lists (ACL).
Stars: ✭ 49 (-93.18%)
Mutual labels:  api, mongodb, express
Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (-78.72%)
Mutual labels:  api, mongodb, express
Node Express Postgresql Sequelize
Node.js, Express.js, Sequelize.js and PostgreSQL RESTful API
Stars: ✭ 148 (-79.42%)
Mutual labels:  api, restful, express
Express Graphql Mongodb Boilerplate
A boilerplate for Node.js apps / GraphQL-API / Authentication from scratch - express, graphql - (graphql compose), mongodb (mongoose).
Stars: ✭ 288 (-59.94%)
Mutual labels:  api, mongodb, express
Nodejs Restful Api
How to create a RESTful CRUD API using Nodejs?
Stars: ✭ 285 (-60.36%)
Mutual labels:  api, mongodb, express
Koa2 Api Scaffold
一个基于Koa2的轻量级RESTful API Server脚手架。
Stars: ✭ 694 (-3.48%)
Mutual labels:  api, restful, express
Node Express Mongodb Jwt Rest Api Skeleton
This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API). Demo of frontend in VueJS here: https://github.com/davellanedam/vue-skeleton-mvp
Stars: ✭ 603 (-16.13%)
Mutual labels:  api, mongodb, express
Nodepress
😎 RESTful API service for Blog/CMS, powered by @nestjs
Stars: ✭ 829 (+15.3%)
Mutual labels:  restful, mongodb, express
Flowa
🔥Service level control flow for Node.js
Stars: ✭ 66 (-90.82%)
Mutual labels:  api, restful, express
Doclever
做最好的接口管理平台
Stars: ✭ 2,849 (+296.24%)
Mutual labels:  api, mongodb, express
Securing Restful Apis With Jwt
How to secure a Nodejs RESTful CRUD API using JSON web tokens?
Stars: ✭ 301 (-58.14%)
Mutual labels:  api, mongodb, express
Rest Api Nodejs Mongodb
A boilerplate for REST API Development with Node.js, Express, and MongoDB
Stars: ✭ 672 (-6.54%)
Mutual labels:  api, mongodb, express
Jackblog Api Express
Jackblog API Server Express版, 个人博客系统, 基于RESTful架构, 使用Node.js, Express, MongoDB, Redis, Token Auth, 七牛云存储等.
Stars: ✭ 405 (-43.67%)
Mutual labels:  restful, express
Mevn Cli
Light speed setup for MEVN(Mongo Express Vue Node) Apps
Stars: ✭ 696 (-3.2%)
Mutual labels:  mongodb, express
Meantorrent
meanTorrent - MEAN.JS BitTorrent Private Tracker - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js, A BitTorrent Private Tracker CMS with Multilingual, and IRC announce support, CloudFlare support. Demo at:
Stars: ✭ 438 (-39.08%)
Mutual labels:  mongodb, express

Node REST API

CI Status Dependency Status Dependency Status License

NodeAPI is REST API server implementation built on top Node.js and Express.js with Mongoose.js for MongoDB 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 and MongoDB installed.

Node setup on macOS

# Update Homebrew before installing all dependencies
brew update

# Install Node (+npm) with Homebrew
brew install node

# Install npm dependencies in project folder
npm install

MongoDB setup on macOS

# Install MongoDB with Homebrew
brew tap mongodb/brew
brew install mongodb-community

# Create directory for MongoDB data
mkdir -p ./data/mongo

# Run MongoDB daemon process with path to data directory
mongod --dbpath ./data/mongo

Run server

npm start
# alias for
node bin/www

Create demo data

npm run-script generate
# alias for
node generateData.js

Docker

You need to have Docker installed.

Run server

docker-compose up -d --build

Create demo data

docker exec nodeapi_node_api_1 node generateData.js

Make Requests

Create and refresh access tokens:

http POST http://localhost:1337/api/oauth/token grant_type=password client_id=android client_secret=SomeRandomCharsAndNumbers username=myapi password=abc1234
http POST http://localhost:1337/api/oauth/token grant_type=refresh_token client_id=android client_secret=SomeRandomCharsAndNumbers refresh_token=[REFRESH_TOKEN]

Create your article data:

http POST http://localhost:1337/api/articles title='New Article' author='John Doe' description='Lorem ipsum dolar sit amet' images:='[{"kind":"thumbnail", "url":"http://habrahabr.ru/images/write-topic.png"}, {"kind":"detail", "url":"http://habrahabr.ru/images/write-topic.png"}]' Authorization:'Bearer ACCESS_TOKEN'

Update your article data:

http PUT http://localhost:1337/api/articles/EXISTING_ARTICLE_ID title='Updated Article' author='Jane Doe' description='This is now updated' Authorization:'Bearer ACCESS_TOKEN'

Get your data:

http http://localhost:1337/api/users/info Authorization:'Bearer ACCESS_TOKEN'
http http://localhost:1337/api/articles 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

JSHint

npm install jshint -g
jshint libs/**/*.js generateData.js

Author

Created and maintained by Evgeny Aleksandrov (@ealeksandrov).

Updated by:

License

NodeAPI is available under the MIT license. See the LICENSE.md file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].