modulepackage
0.0.0-20240722154657-2cd3371c5c9c
Repository: https://github.com/opc-16/rms-server.git
Documentation: pkg.go.dev
# README
Go-based RMS-server Application
Backend server for a Recruitment Management System
Features
- 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.
Installation
Prerequisites
- Go 1.16 or higher
- Redis
Steps
-
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
Usage
Echo Server
This project uses the Echo web framework for routing and middleware.
Redis Database
User information and logs are stored in Redis, ensuring fast and efficient data retrieval.
JWT Token Authentication
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
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).
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
Code Structure
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).
# Packages
No description provided by the author
No description provided by the author
No description provided by the author