Skip to content

A simple NodeJs template without unnecessary dependencies to help you prototype your rest service for study case or even to production.

License

Notifications You must be signed in to change notification settings

brworkit/nodejs-express-api

Repository files navigation

NodeJs Express API

Description

A simple NodeJs template to help you prototype your rest service for study case or even to production. It uses minimum modules as possible and MongoDb as database.

Requirements

For development, you will only need Node.js and a node global package, installed in your environement.

Node

  • Node installation on Windows

    Just go on official Node.js website and download the installer.

  • Node installation on Ubuntu

    You can install NodeJs and npm with apt install, using the following commands:

    $ sudo apt install nodejs
    
    $ sudo apt install npm
    
  • Other Operating Systems

    You can find more information about the installation on the official Node.js website and the official NPM website.

If the installation was successful, you should be able to run the following command from your command line:

$ node --version        

$ npm --version

MongoDb

After you install MongoDb in your local machine make sure it is running, then you are ready!

Installation

Project

$ git clone https://github.com/brworkit/nodejs-server-template.git
$ cd nodejs-server-template
$ npm i [to install all required modules]

Usage

Start server using:

$ node server.js or npm start (you choose)

API

POST /users/registration

{
    "username",
    "email",
    "password"
}

POST /users/authenticate

{	    
    "email",
    "password"
}

PUT /users/update

{	    
    "username",
    "email"
}

GET /users

{
    "message": "Users found",
    "result": [
        {                
            "id",
            "username",
            "email",
            "created"                
        }
    ]
}

DELETE /users/:id

{
    "message"
}

POSTMAN

You can import the NODEJS-SERVER-TEMPLATE.postman_collection.json file into your postman to test API.

License

MIT License.
Copyright (c) 2020 brworkit.

About

A simple NodeJs template without unnecessary dependencies to help you prototype your rest service for study case or even to production.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published