- GO
- fiber framework
- jwt package
- gorm for database manipulation
- mail package for email validation
- MYSQL
- Make sure mysql database is running on the machine.
- Set the database connection information in
database/connection.go
file. - Create the matching database name inside local database specified in
database/connection.go
file. - Make sure the go env variable GO111MODULE is set to on or auto if not than run this command
go env -w GO111MODULE=auto
- Download all the dependencies running
go mod download
- Run the project by using the command
go run main.go
- Alternate way to run using the
go build -o executable_file_name
and then run the./executable_file_name
-
Method
POST
- Endpoint
/api/register
- This endpoint allows to register the user with the provided information
- Below is the accepted JSON format
{
"name": "valid username",
"email": "valid email id",
"password": "valid password"
}
- Endpoint
-
Method
POST
- Endpoint
/api/login
- This endpoint allows to login
- This method returns the cookie in which JWT token is embeded
- Endpoint
-
Method
GET
- Endpoint
/api/user
- This endpoint returns the currently logged in user information
- Below is the data returned by this method
{
"ID": "Currently logged in user id"
"name": "Currently logged in username",
"email": "Currently logged in user email id",
}
- Endpoint
-
Method
Post
- Endpoint /api/logout
- This endpoint clears the user session
NOTE :
Below are the constraints for above fields
name
- length of the name field should be greater than
four
and only uppercase and lowercase letter's are allowed
- length of the name field should be greater than
email
- Entered email id should follow the normal valid email id format
password
- length should be
greater than or equal to 8
- one uppercase letter
- one lowercase letter
- one digit
- one special symbol from this list
! @ # $ % ^ &
- length should be