- Postgres
- Docker
- Gin
- gRPC
- asynq
- golang-migrate
- sqlc
- testify
- PASETO Security Tokens
- jordan-wright/email
- Clone the repository
- Go to the project's root directory
- Rename
app.env.sample
toapp.env
and replace the values - Run in your terminal:
docker-compose up --build
to run the containers
- Now everything should be ready and server running on
SERVER_ADDRESS
specified inapp.env
- Run the postgres container (
docker-compose up
) - Run in your terminal:
make test
to run all tests ormake test_coverage p={PATH}
- to get the coverage in the HTML format - where{PATH}
is the path to the target directory for which you want to generate test coverage. The{PATH}
should be replaced with the actual path you want to use. For example./api
or- use standard
go test
commands (e.g.go test -v ./api
)
/users
- handles POST requests to create users./users/login
- handles POST requests to log in users.
/tokens/renew
- handles POST requests to renew the access tokens.
/category
- handles POST requests to create categories/category/{name}
- handles DELETE requests to delete a category
/posts
- handles POST requests to create posts./posts/{id}
- handles DELETE requests to delete a post./posts/id/{id}
and/posts/title/{slug}
- handles GET requests to get post details./posts/all
- handles GET requests to list all posts. Query params:page
,page_size
./posts/author
- handles GET requests to list posts created by author with given name (that username or email contain given string). Query params:page
,page_size
,author
./posts/category
- handles GET requests to list posts from the given category. Query params:page
,page_size
,category_id
./posts/tags
- handles GET requests to list posts with given tags. Query params:page
,page_size
,tag_ids
wheretag_ids
is comma-separated int format (e.g.&tag_ids=1,2,3
)./posts/{id}
- handles PATCH requests to update the post.
/comments
- handles POST requests to create a comment./comments/{id}
- handles DELETE requests to delete a comment./comments/{id}
- handles PATCH requests to update a comment./comments/{post_id}
- handles GET requests to list comments of a post. Query params:page
andpage_size
.
The API (HTTP gateway) documentation can be found at this swaggerhub page and (after running the server) at http://localhost:8080/docs/
The database's schema and intricate details can be found on
dedicated webpage, which provides a comprehensive overview
of the data structure, tables, relationships, and other essential
information. To explore the database further, please visit
this dbdocs.io webpage.
Password: bloggopassword