A simple, prototyping account management API service developing with Golang, that can:
- Register a new account.
- Login/logout.
- Show/edit account info.
- Go v1.11 with Go Module
- MongoDB v3.6+
- Clone this project to local.
- Shift to the project folder.
- Generate swagger doc files:
swag init -g routes/routes.go
P.S. You need to run this command to re-generate swagger doc files everytime you modified Go annotations for changing API spec. - Run
go build main.go
to build project on the first time. - Launch service: run
./main
on Linux/macOS, or.\main.exe
on Windows.
- host: the host name (IP, domain name) listening. Default:
localhost
- port: the number of HTTP port for listening. Default:
3000
- database: the connection URL to connect the MongoDB for data storage. Default:
mongodb://localhost/api-exercise
Documentation & Testing UI generated by swagger. URL: http://<hostname_or_ip>:<port>/swagger/
Default URL: http://localhost:3000/swagger/
- Do user register first before login.
- Show/Edit user info API will work fine when session key exist into header. Session key will generated by login API.