Backend part of the User Managament System written in Go.
- Programming Language: Go
- API Documentation: Swagger
- Mocking: Mockery
- Unit Testing: Go testing package
- Docker: Containerization for deployment
To run the backend, follow these steps:
-
Install Go packages:
go get ./...
-
Run the project:
go run .
The backend will be available at http://127.0.0.1:3001
The unit test suite covers functions such as handling Getting All Users, Getting User By Id, Creating User, Updating User and Deleting User
For API documentation, visit Swagger Documentation. This documentation provides insights into available operations.
-
GET /api/users
- Get a list of all users.
-
POST /api/users
- Create a new user.
-
GET /api/users/{id}
- Get a user by ID.
-
PUT /api/users/{id}
- Update a user by ID.
-
DELETE /api/users/{id}
- Delete a user by ID.
Mockery was utilized for mocking in unit tests, following the "given when then" principle.
To run tests:
go test ./...
To build and run the backend using Docker:
- Build the Docker image:
docker build --tag fl-case-study-backend .
- Run the docker container
docker run -p 3001:3001 fl-case-study-backend
Now, the backend is accessible at http://localhost:3001