Skip to content

BrunoPolaski/go-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoLang API Rest

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.

Main tools

MongoDB JWT Docker

Other tools inside this project

  • Gin
  • Testify
  • Gomock
  • Zap

Status

Build status

Initializing without Docker

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.go

Initializing with Docker

To start the app, mongo and mongo-express, make sure you have docker installed and simply run in the terminal:

docker compose up

And 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/user

And log in the server with:

curl -u <username>:<password> localhost:8080/auth/login

Testing

To test the app, you must run the following command in the terminal:

go test -v ./...

About

A GO project that contains some interesting concepts that made me learn more about back-end programming. Include concepts like JWT authorization, NoSQL database, tests, logger, docker, MVC architectural pattern and more.

Topics

Resources

Stars

Watchers

Forks

Used by

Contributors

Languages