Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

makinhs/rest-api-tutorial

Repository files navigation

REST API Tutorial

This sample is published as part of the corresponding article at the Toptal Engineering Blog. Visit https://www.toptal.com/developers/blog and subscribe to our newsletter to read great posts!

Before using

  • Please make sure that you have:
  • Node.js installed (https://nodejs.org/)
  • MongoDB installed and running locally (https://www.mongodb.com/)
    • Using Windows, just open the terminal at where you installed mongo and run mongod.exe
  • Run npm install or yarn in your root project folder

Usage

To run the project, please use a command line the following:

  • npm start
    • It will run the server at port 3600.

2019年09月13日 update

  • Refactored mongoose to a proper common service.
  • Added a Dockerfile and docker-compose configuration.

If you are familiar to docker and you have docker installed on your machine and just want to run the project without issues please do:

  • docker-compose build
  • docker-compose up
  • It will run the mongodb at port 27017 (for testing purposes only).
  • It will run the server at port 3600.

2020年02月01日

I've created a 2020 version of this project using Typescript. If you might be interested on it, please check the following repository: https://github.com/makinhs/expressjs-api-tutorial

2020年09月09日

  • Updated and pruned dependencies.
  • Fixed deprecation warnings.
  • Leveraged findOneAndUpdate to simplify PATCH code.
  • Changed default MongoDB server name to localhost to simplify first-time setup.
  • Checked that it works with the latest version of Node.js, 14.9.0.

2020年11月14日

About

This is a sample source code for the article published on Toptal: https://www.toptal.com/nodejs/secure-rest-api-in-nodejs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 9

AltStyle によって変換されたページ (->オリジナル) /