A user authentication api written in GO with MongoDB as main datastore.
- Clone repo
git clone https://github.com/afifialaa/user-auth.git
- Install dependencies
go get
Action | Method | URL |
---|---|---|
Login | POST | /api/user/login |
Signup | POST | /api/user/signup |
curl -X POST -d 'email=johndoe@example.com&password=jdoe123' http://localhost:8000/api/user/login
HTTP/1.1 200 Ok
Date: Tue, 13 Apr 2021 11:23:38 GMT
Status: 200 Ok
Content-Type: application/json
Content-Length: 130
{"token":"IUzI1NiIsInR5cCI6IkpXVC.IUzI1NiIsInR5cCI6IkpXVC.IUzI1NiIsInR5cCI6IkpXVC"}
curl -X POST -d 'email=johndoe@example.com&password=jdoe123' http://localhost:8000/api/user/signup
HTTP/1.1 201 Created
Date: Tue, 13 Apr 2021 11:23:38 GMT
Status: 201 Created
Content-Type: application/json
Content-Length: 40
{"msg": "User was created successfully"}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.