The purposes of the project are:
- to see how the Go app structure can be organized
- to understand how restful API works
- to upgrade my knowledge of the Go standard library (packages
net/http
,database/sql
, ...) - to work with
postgresql
database,migrate
tool,docker
containers
All files from static
folder were already crated. I wrote the rest myself.
Before launching the application, you must specify all sensitive data
in the .env
file (see example.env
).
then enter the command below:
make compose-up
POST /api/register
- user registrationPOST /api/login
- user loginGET /api/posts/
- list of all postsPOST /api/posts
- adding a post (url/text
)GET /api/funny/{category_name}
- list of posts with the certain categoryGET /api/post/{post_id}
- certain postPOST /api/post/{post_id}
- adding a commentDELETE /api/post/{post_id}/{comment_id}
- deleting a postGET /api/post/{post_id}/upvote
- upvote post ratingGET /api/post/{post_id}/downvote
- downvote post ratingGET /api/post/{post_id}/unvote
- unvote post ratingDELETE /api/post/{post_id}
- deleting a postGET /api/user/{username}
- list of all posts of the certain user
- write tests
- add gRPC, CLI transport
- create customError type like
type CustomError struct {Err error, HTTPCode int}
which will allow to remove all switch operators in a transport layer