A simples Go messenger application created to improve Golang skills.
In this application you can create users, authenticated with AWS cognito, search for other active users and exchange messages with them.
There are open endpoints and endpoints that need authorization. Authorization is granted to confirmed users after login.
To access these endpoints bearer token authporization is required.
Authorized endpoints are a bit redundant, authorization wise and user wise. I was looking for a way to handle all authorized connections in one place but couldn't find, but that's an improvement I'd work on. Also I needed a local users table to list and filter them, but creates some seemenly code redundancies.
Endpoints are a bit out of pattern, for my linking. For instance, an endpoint that gives a user informations should be "GET /users/{id}", but the user already have the authorization token and, for now, doesn't have access to other users, so it made sense to use just "GET /user" with bearer token authorization. This was a choice, I guess, I could have gone the other way.
Also, the messages and chat endpoints uses username. My first thought was to use Id, but for me a "/messages/{id}" endpoint would suggest getting a specif message, not messages exchanged between 2 users.
More improvements: