DebdutBiswas / codelogicx-ves-api

Visitor Entry System API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

codelogicx-ves-api

Visitor Entry System API

Live API link:

To be added later via heroku docker deploy

Easiest way to setup and run if you have docker installed:

  docker compose up -d

Manual setup:

Install required node modules

  npm install

Databse setup

Create database user and database

  • Create a new database user set mysql authentication type to 'Native MySQL authentication'
  • Create a new database and give all permissions to the previously created user

Import dummy database dump

  mysql -u <user_name> -p <database_name> < ./schemas/dummy.sql

Setup environment variables

  • Create a file named .env and edit it
  touch .env
  nano .env
  • Put the following contents to the file and save it
  DB_HOST=localhost
  DB_PORT=3306
  DB_TYPE=mysql
  DB_USER=<user_name>
  DB_PASS=<database_password>
  DB_DBASE=<database_name>
  JWT_ACCESS_TOKEN_SECRET=rANd0m34673
  JWT_REFRESH_TOKEN_SECRET=RanD0M65749

How to run the code?

First, start the server

  npm start

Test REST APIs

  • Import Postman REST API test project to Postman from:
  ./tests/codelogicx-ves-api.postman_collection.json
  • Now you are ready to test the API from Postman
  • All the required API keys and test parameters are with in the Postman project
  • If required to check user authentication then use credentials given below:
{
    "username": "admin",
    "password": "admin@123"
}

Database Schema Design:

Here is a relationship diagram of various database tables:

DBRelationshipDiagram

About

Visitor Entry System API

License:MIT License


Languages

Language:JavaScript 97.4%Language:Dockerfile 2.6%