A users Rest API using Go with the MVC architectural pattern, along with a login that verifies the user credentials. The create user method encrypts with jwt before saving in MongoDB, then the user is able to login.
- Gin
- Testify
- Gomock
- Zap
If you don't have docker installed, you can install Mongo and MongoExpress, create a collection and start to use it by running the application with:
go mod download
go run main.goTo start the app, mongo and mongo-express, make sure you have docker installed and simply run in the terminal:
docker compose upAnd you will be ready to go!
After this, you can create a user with:
curl --json '{
"email": "test@gmail.com",
"name": "John",
"age": 22,
"password": "Chewbacca@777"
}' localhost:8080/userAnd log in the server with:
curl -u <username>:<password> localhost:8080/auth/loginTo test the app, you must run the following command in the terminal:
go test -v ./...