Code Monkey home page Code Monkey logo

crm-service-api's Introduction

crm-service-api by Beatriz Avis

Version Twitter: NishyIR

API built with NodeJS and Express connected to MongoDB with Mongoose.

Download

git clone https://github.com/BeAvisP/crm-service-api.git

cd crm-service-api

Install

npm install

This command will install all the dependencies needed to run de API.

Initial configuration

In order to start using the API you need to have create an Admin user in the database.

In the bin folder you will find the script to create the first user in seeds.js.

By default the user created will be:

 {
  email: '[email protected]',
  firstname: 'Admin',
  lastname: 'User',
  password: '123456,
  role: 'admin',
}

Feel free to change the data in the seeds.js file with the values you need.

Execute the next command to create de user:

node bin/seeds.js

Usage

To run build and run the API:

npm run start

The URL of the API will be localhost:3001

Endpoints Table

HTTP Method Endpoint Request Body Success status Error Status Description
GET /api/auth/loggedin Saved session 200 500 Check if user is logged in and return the user
POST /api/auth/login { email, password } 200 401 - 500 User login - Return the user
POST /api/auth/logout 200 User logout
POST /api/auth/new { firstname, lastname, email, password, role } 201 400 - 500 Create new user - Only allowed for Admins
GET /api/auth/users 200 500 Return all users - Only allowed for Admins
GET /api/auth/:id 200 500 Return user info - Only allowed for Admins
PUT /api/auth/:id { firstname, lastname, role } 200 500 Edit user info and role - Only allowed for Admins
DELETE /api/auth/:id 200 500 Delete user - Only allowed for Admins
GET /api/customers 200 500 Return all customers - Auth is required
POST /api/customers { name, surname, photo } 201 400 - 500 Create new customer - Auth is required
GET /api/customers/:id 200 500 Return customer by id - Auth is required
PUT /api/customers/:id { name, surname, photo } 200 500 Edit customer info - Auth is required
DELETE /api/customers/:id 200 500 Delete customer - Auth is required

Author

👤 Beatriz Avis

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

crm-service-api's People

Contributors

beavisp avatar

Watchers

 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.