- Notifications
You must be signed in to change notification settings - Fork0
aalug/blog-go
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
- 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 testsormake 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 authorwith 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
iscomma-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 atthis swaggerhub pageand (after running the server) athttp://localhost:8080/docs/
The database's schema and intricate details can be found ondedicated webpage, which provides a comprehensive overviewof the data structure, tables, relationships, and other essentialinformation. To explore the database further, please visitthisdbdocs.io webpage.Password:bloggopassword