off-the-az / My-E-Planner-v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project done: 23.06, 17:50

My E-Planner

My E-Planner API is one of the main parts of the overall My E-Planner Project based on JavaScript using NodeJS and ExpressJS.

How to use this API:

If you want to use this API in your application you need to fetch code to your server(local or remote):

> git clone https://github.com/off-the-az/My-E-Planner-v2.git

Next, you need to install project dependencies:

> npm i --save

After you have installed you need to install PM2 service on your server (Ubuntu / Ubuntu Server):

> sudo npm install pm2@latest -g

After installing this service, you need to init for startup and servicing your NodeJS project:

> pm2 startup systemd

After that, you need to install MongoDB database using mongosh. The correct instruction here

Next, you need to run yout NodeJS application and save service on PM2:

> pm2 start main.js
> pm2 save

If you want to check service status, run the following command:

> systemctl status pm2-<your-pc-username>

After setup and configure you can use the following API in your application!) Enjoy!)

Adding generated records to Databases (Factory Module):

To add new records u need to run command below:

> npm run factory-<factory-type>

We have 3 factory types to run this command. Here is the explanation of each type:

  • user - generate random users;
  • events - generate random events;
  • f-r - adding doned records from resources directory;

Basic API endpoints:

This API implements all possible options for requests that allow you to organize stable functionality of the project, such as - GET, POST, PUT, DELETE.

The following links allow you to work with database information:

- User`s data:
    - [GET] http://<ip-adress>:6000/api/user/get
    - [GET] http://<ip-adress>:6000/api/user/get/byId/<user-id>
    - [GET] http://<ip-adress>:6000/api/user/get/byToken/<user-token>
    - [UPDATE] http://<ip-adress>:6000/api/user/update/<user-token>
    - [DELETE] http://<ip-adress>:6000/api/user/delete/byId/<user-id>
    - [DELETE] http://<ip-adress>:6000/api/user/delete/<user-token>

    For Authorization:
    - [POST] http://<ip-adress>:6000/api/user/login/<users-email>/<users-password>
    - [POST] http://<ip-adress>:6000/api/user/logout/<users-token>
    - [POST] http://<ip-adress>:6000/api/user/register

- Event`s data
    - [GET] http://<ip-adress>:6000/api/events/get
    - [GET] http://<ip-adress>:6000/api/events/get/byOwner/<user-id>
    - [GET] http://<ip-adress>:6000/api/events/get/byId/<event-id>
    - [GET] http://<ip-adress>:6000/api/events/get/byDone/<event-status-isDone>(0|1 or true|false)
    - [POST] http://<ip-adress>:6000/api/events/add
    - [PUT] http://<ip-adress>:6000/api/events/update/<event-id>
    - [DELETE] http://<ip-adress>:6000/api/events/delete

Basic links to project resources:

Telegram Notiticator Bot: https://t.me/@MyEPlannerNoficatorBot

Test records for importing to MongoDB Documents:

About


Languages

Language:JavaScript 100.0%