I use existing libs :
- Chi Router
- Ozzo Validation, for input request validation
- Godotenv, for env loader
- testify for unit testing
- cd dating_app
- go mod tidy
- go to the package you want to testing then run a command "go test"
- you can see the coverage testing in each package by open the project with vscode, choose the testing file, right click then choose "Go:Toogle Test Coverage in Current Package"
I use Postgresql for DB
in folder db, there are some .sql files with the create table command. you can run the command in your sql editor page.
after clone and do some set up that explained before, do this following actions :
- make .env file by copying the .env.example and set database credential in the .env file
- go run main.go
you can dorp these curl into postman etc
-
curl --location --request POST 'http://localhost:8080/api/user/register'
--header 'Content-Type: application/json'
--data-raw '{ "email":"jody.almaida@gmail.com", "password" : "1234567" }' -
curl --location --request POST 'http://localhost:8080/api/user/login'
--header 'Content-Type: application/json'
--data-raw '{ "email":"jody.almaida@gmail.com", "password" : "1234567" }'