Giter VIP home page Giter VIP logo

usermanager's Introduction

License: MIT

User Manager

This repository contains a simple demo API built with NodeJS. The API is used to manage users in a MongoDB database.

Guide to Setup Docker and Deploy

FOR LINUX USERS(NON-VIRTUALIZED PC[This computer doesn't have VT-X/AMD-v enabled])

  • Clone the repository by entering the command in the terminal.
git clone https://github.com/nerdeveloper/UserManager.git
  • Navigate to the project folder using cd UserManager on your terminal

  • Run the deployment script to set up

npm i && touch .env && cp -r .env-sample .env && chmod +x setup.sh && ./setup.sh

Warning

There is no need to Install Docker or any other Program(manually). This Shell Script I have developed checks for all the Programs required(Installed or not) for a successful Deployment.

FOR MAC OS/LINUX USERS(VIRTUALIZED PC[This computer has VT-X/AMD-v enabled])

  • Clone the repository by entering the command in the terminal.
git clone https://github.com/nerdeveloper/UserManager.git
  • Navigate to the project folder using cd UserManager on your terminal

  • Run the deployment script to set up

npm i && touch .env && cp -r .env-sample .env && chmod +x install.sh && ./install.sh

Warning

There is no need to Install Docker or any other Program(manually). This Shell Script I have developed checks for all the Programs required(Installed or not) for a successful Deployment.

Development

This application was developed using ExpressJS. MongoDB was used for persisting data with Mongoose as ORM.

Installation

  • Start up your terminal (or Command Prompt on Windows OS).
  • Ensure that you've node installed on your PC.
  • Clone the repository by entering the command git clone https://github.com/andela-bolajide/UserManager in the terminal.
  • Navigate to the project folder using cd UserManager on your terminal (or command prompt)
  • After cloning, install the application's dependencies with the command npm install.
  • Create a .env file in your root directory as described in .env.sample file. Variables such as DB_URL (which must be a mongoDB URL) and PORT are defined in the .env file and it is essential you create this file before running the application.
PORT=3000
DB_URL='mongodb://john:doe@localhost:27017/databaseName'
  • After this, you can then start the server with the command: npm start.

Testing

To ensure that your installation is successful you'll need to run tests. The command: npm test makes this possible. It isn't functional right now, but once it's done you'll be notified via the README.

API Documentation

The API only has one endpoint which is the /users endpoint for saving users to the database. The endpoint works with the HTTP verbs: POST, GET, PUT, DELETE.

POST HTTP Request
  • POST /users
  • INPUT:
name: John Doe
email: [email protected]
password: johndoe
HTTP Response
  • HTTP Status: 201: created
  • JSON data
{
  "_id": "59071791b0lkscm2325794",
  "name": "John Doe",
  "email": "[email protected]",
  "password": "johndoe",
  "__v": 0
}
GET HTTP Response
  • GET /users
[
    {
        "_id": "59071791b0lkscm2325794",
        "name": "John Doe",
        "email": "[email protected]",
        "password": "johndoe",
        "__v": 0
    }
]
GET HTTP Response
  • GET /users/:id
{
    "_id": "59071791b0lkscm2325794",
    "name": "John Doe",
    "email": "[email protected]",
    "password": "johndoe",
    "__v": 0
}
DELETE HTTP Response
  • DELETE /users/:id
User John Doe was deleted
POST HTTP Request
  • PUT /users/:id
  • INPUT:
name: Jane Doe
email: [email protected]
password: janedoe
HTTP Response
  • HTTP Status: 200: OK
  • JSON data
{
  "_id": "59071791b0lkscm2325794",
  "name": "Jane Doe",
  "email": "[email protected]",
  "password": "janedoe",
  "__v": 0
}

Author

Olajide Bolaji 'Nuel - Software Developer at Andela

usermanager's People

Contributors

nerdeveloper avatar bolajiolajide avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.