Backend server for a Recruitment Management System
- Code Quality: The codebase adheres to clean code practices, emphasizing modularity and readability.
- Redis Database: Uses Redis as a database for storing user information and logs.
- JWT Token Authentication: Uses JWT for user authentication.
- Middleware: Utilizes middleware to enhance functionality, such as JWT authentication and role-based access control.
- Go 1.16 or higher
- Redis
-
Clone the repository:
git clone https://github.com/OPC-16/RMS-server cd RMS-server
-
Install dependencies:
go mod tidy
-
Run Redis server (if not already running):
redis-server
or
docker run -p 6379:6379 redis:latest
-
Build and run the application:
go run main.go
This project uses the Echo web framework for routing and middleware.
User information and logs are stored in Redis, ensuring fast and efficient data retrieval.
JWT tokens are used to authenticate users. After signing up, users receive a token upon logging in, which they must include in subsequent requests.
Middleware functions are used to:
- Authenticate users using JWT tokens.
- Restrict access to certain routes based on user roles (e.g., only admins can access specific routes).
-
Signup:
/signup
curl -X POST http://localhost:3000/signup -d '{"name":"Alice","email":"[email protected]","password":"password123","usertype":"Applicant"}' -H "Content-Type: application/json"
-
Login:
/login
curl -X POST http://localhost:3000/login -d '{"email":"[email protected]","password":"password123"}' -H "Content-Type: application/json"
-
Post a Job:
/admin/job
curl -X POST http://localhost:3000/admin/job -H "Authorization: Bearer your_jwt_token_here" -H "Content-Type: application/json" -d '{"title": "Go Developer", "description": "Develop go applications"}'
-
Upload Resume:
/uploadResume
curl -X POST -H "Authorization: Bearer your_jwt_token_here" localhost:3000/uploadResume
main.go
: Entry point of the application.application/app.go
: Creating and starting new app instance.application/routes.go
: Define routes and middleware.handler/handler.go
: Contains route handlers.model/model.go
: Defines data models (e.g., User struct).