A NodeJS RESTful API example with Express.
Table of Contents
This project should help you get an idea of creating a RESTful API in NodeJS. It's utilizes Mongoose for models and writes to a MongoDB instance.
Follow these quick and easy steps and you'll be up and running in no time.
- Clone the repo
git clone https://github.com/TwiggyBuffalo/nodejs-api-example.git
- Install dependencies
npm i
- Either start a local MongoDB instance using the
mongod
cmd or alternatively provide and env variable as follows for a remote MongoDB instanceDB_URL=mongodb://connection-string-here
- Start the project by running
npm run start
- Open a web browser and head over to http://localhost:3000/users to fetch users. To create users POST to the same URL with the body
{ name: Joe Soap email: joe@soap.com password: J03S04P! }
See the open issues for a list of proposed features (and known issues).
- Fork the Project
- Make your changes
- Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Twitter - @TwiggyBuffalo
GitHub - TwiggyBuffalo