Welcome to the Role based repository! This server is designed to handle various functionalities related to employee management within a company.
- Overview
- Getting Started
- Project Structure
- Configuration
- Usage
- API Documentation
- Contributing
- License
The Role based is built to manage employee data, roles, and related operations within the organization. It provides RESTful APIs for employee registration,entication, andorization.
-
Clone the repository:
git clone https://github.com/Francis-Mwaniki/role-based.git cd role-based
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory of the project and add the following environment variables:PORT=3000 MONGODB_URI=mongodb://localhost:27017/role-based JWT_SECRET=secret
-
Start the server:
npm start
-
Navigate to http://localhost:3000 in your browser to explore the API.
├── src
│ |
│ │
│ ├── controllers
│ ├── login.js
│ ├── signup.js
│
│
│ ├── middleware.js
│ │
│ │
│ ├── models
│ │ ├── employee.js
│ │
│ ├── routes
│ │ ├── user.js
│ │
│ │
│ |
│ └── index.js
├── .env.example
├── .gitignore
├── package.json
├── package-lock.json
└── README.md
The Role based provides the following RESTful APIs:
-
POST /api/register-se
- Register a new Software engineer employee -
POST /api/register-hr
- Register a new Human Resource employee -
POST /api/register-admin
- Register a new admin employee -
POST /api/Login-se
- Login a Software engineer employee -
POST /api/Login-hr
- Login a Human Resource employee -
POST /api/Login-admin
- Login a admin employee -
Protected routes
-
GET /api/marketers-protected
- right to marketers -
GET /api/admin-protected
- right to admin -
GET /api/hr-protected
- right to human resource employees -
GET /api/se-protected
- right to software engineers