- Create a
.env
file and add the secret keys.
PORT =
MONGODB_URI =
SECRET_KEY =
You can generate the SECRET_KEY from https://www.javainuse.com/jwtgenerator
- go mod tidy ensures that the go. mod file matches the source code in the module. It adds any missing module requirements necessary to build the current module's packages and dependencies, if there are some not used dependencies go mod tidy will remove those from go.
go mod tidy
air
command will build the project and start the server. Refer https://github.com/cosmtrek/air
air
- POST :
https://localhost:5050/user/signup
{
"first_name" : "",
"last_name" : "",
"email" : "",
"password":""
}
- POST :
https://localhost:5050/user/login
{
"email":"",
"password":""
}
- Get specific user data by ID (Provide the
token
in request header)
GET : https://localhost:5050/users/<USER_ID>
- Get all users' data (Provide the
token
in request header)
GET : https://localhost:5050/users