Golang REST API service for getting friends birthday notifications.
Built with Gin and MongoDB
Supports the next REST API commands:
- POST /api/signup/ - Create a new user. 2 .POST /api/auth/ - Auth to get JWT tokens to use the commands below
- GET /api/user/:id - Get specific user data by his ID
- GET /api/users - Get all users data
- POST /api/addFriend/:id - Add the user to the current user's friends list; therefore, he will get a notification about birthdays.
- POST /api/removeFriend/:id - Remove the user from the current user's friends list; therefore, he will not get a notification about birthdays.
- GET /api/birthdays - Show all friends that have birthdays today.
- api - contains files to define routes and server side interaction-
- cmd - contains file to start the service
- internal - all project files that should not be used from the outside
- models - types that are used to structure data
- controllers - functions that can interact with models and api
- database - mongoDB helpers
- utils - helper files that can be used outside of the project
- tests - unit-test files
- Dockerfile - file to containerize project
- docker-compose - file to create composed container with mongoDB
- You can use Docker to make it easier
docker-compose up --build .
-
Or you can use your own mongoDB on local machine (make sure that you've change mongodb port in .env file).
For that you can use command
go run ./cmd/app/main.go
To run tests use command
go test ./tests