/API-TEST-CRM-SERVICE

Primary LanguageJavaScriptMIT LicenseMIT

Agile API Test

API - CRM Service


Index

  1. About
  2. Set up
  3. Usage
  4. Cotribution Requests
  5. License
  6. Contact
  7. Technologies

About

This project is a test based on a CRM Service. You would be able to work with users with different permits and customers.


Set Up

First, you will need several techs and tools to work with the API. In case you have doubts, you could find all the links to all the documentation of each.

Requisites

· NodeJS

First, you'll need to install Node

sudo apt install nodejs

Make sure you have Node installed and which version with:

node --version

· NPM

npm install npm@latest -g

· Nodemon

Is not a must, but I recomend it

Global:
npm install -g nodemon

Dependency:

npm install --save-dev nodemon

· MongoDB

With Mongo you can work from Web Navigator or download the app. To connect it, you need to erase '.sample' from '.env' filename. The predetermined configuration works on local.

· Postman

In case you work without Front, you will need Postman to check the lifecycle of the API. As Mongo, you can download it or work on Web Nav. You'll find the last Collection created for this API on this repo.

Installation

1.- Clone the Repository

git clone https://github.com/your_username_/Project-Name.git

2.- Install NPM Packages

You need to be on the Repository folder

npm install

3.- Check environment

Configure your variables in '.env' and 'config.js' files.

4.- Run the API

npm run start

Usage

Those are the endpoints of the current API. To use it, even on a new database, you have setted up a 'admin' user on the initial build.

Authentication

METHOD ENDPOINT TOKEN ROLE PARAMS CONTROLLER RETURN
POST /api/login No No Email, password Login Token

User Endpoints

METHOD ENDPOINT TOKEN ROLE PARAMS CONTROLLER RETURN
POST /api/users Yes Admin userSchema createUser Object of the user created
GET /api/users Yes Admin Query in pages getUsers Array of all users
GET /api/users /:userId Yes Admin ObjectId: ‘userId’ getUserById Object of the specific user
PUT /api/users /:userId Yes Admin ObjectId: ‘userId’ updateUser Object of the user updated
DELETE /api/users /:userId Yes Admin ObjectId: ‘userId’ deleteUser Message to confirm the action

Customer Endpoints

METHOD ENDPOINT TOKEN ROLE PARAMS CONTROLLER RETURN
POST /api/customers Yes No customerSchema createCustomer Object of the customer created
GET /api/customers Yes No Query in pages getCustomers Array of all customers
GET /api/customers /:customerId Yes No ObjectId: ‘customerId’ getCustomerById Object of the specific customer
PUT /api/customers /:customerId Yes No ObjectId: ‘customerId’ updateCustomer Object of the customer updated
DELETE /api/customers /:customerId Yes No ObjectId: ‘customerId’ deleteCustomer Message to confirm the action

Contribution Requests

In case you want to contribute in this project you have to follow the next steps:

1.- Fork the project on your GitHub account
2.- Create a new Feature Branch git checkout -b feature/NewFeature
3.- Add your work to the branch git add feature/NewFeature or . (be careful, this will add every change you made)
4.- Commit the changes git commit -m 'Short description of the commit'
5.- Do a push into the branch git push origin feature/NewFeature
6.- Go to GitHub and open a Pull Requests


License

Distributed under the MIT License. See LICENSE for more information.


Contact

Manuel González - GitHub - LinkedIn


Build

Other Techs and Libraries

Dependencies:

Develop Dependencies:

Global Dependencies: