Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

NodeAPI

> 后端框架
Open source

Simple RESTful API implementation on Node.js + MongoDB.

763 stars0 likes2 views
WebsiteGitHub

About

Simple RESTful API implementation on Node.js + MongoDB.

Node REST API

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

bash
# 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

bash
# 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

bash
npm start
# alias for
node bin/www

Create demo data

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

Docker

You need to have Docker installed.

Run server

bash
docker-compose up -d --build

Create demo data

bash
docker exec nodeapi_node_api_1 node generateData.js

Make Requests

Create and refresh access tokens:

bash
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:

bash
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:

bash
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:

bash
http http://localhost:1337/api/users/info Authorization:'Bearer ACCESS_TOKEN'
http http://localhost:1337/api/articles Authorization:'Bearer ACCESS_TOKEN'

Tests

bash
npm test
# alias for
node ./test/server.test.js

Modules used

Some of non-standard modules used:

  • express
  • mongoose
  • nconf
  • winston
  • faker
  • oauth2orize
  • passport

Test modules:

  • tape
  • superagent

Tools used

  • httpie - command line HTTP client

JSHint

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

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.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptapiexpressmongodbnodejs

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架