simple api to login using jwt and implemented using golang & manggoDB
clone this project to your local.
clone https://github.com/martinyonathann/api-login-go.git
Open config/db/db.go then change :
const (
password = "your password"
dbname = "db name"
)
running the project
go run main.go
POST /registrasi HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Content-Length: 107
{
"username":"username",
"firstname":"firstname",
"lastname":"lastname",
"password":"pwd"
}
POST /login HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Content-Length: 58
{
"username":"username",
"password":"pwd"
}
GET /profile HTTP/1.1
Host: localhost:8080
Authorization: <<response Token from Registration>>