CRUD for users and address registration via geolocation.
- Implement the global system position(GPS).
- When entering the address this application will show the geolocation of the entered address storing asynchronously in the database.
- go 1.17.3
- PostgreSQL 12.9
- Clone this repo or
go get github.com/wesleymsan/go-geolocation - You need to have PostgreSQL installed on your machine.
- Create the database:
geolocation_api - Create the user in the database:
CREATE USER username WITH PASSWORD 'password'; - Run in your terminal:
go run main.go
| Endpoint | Method | Note |
|---|---|---|
| /users | GET | Will provide login and password |
| /users/{id} | GET | Will provide login and password |
| /posts | GET | Will provide all database |
| /login | POST | Use login and email, will provide token |
| /users/{id} | DELETE | Athorization: Bearer Token |
| /users/{id} | PUT | Athorization: Bearer Token |
| /users | GET | No token required |
| /posts/{id} | PUT | Athorization: Bearer Token |
| /posts | POST | Athorization: Bearer Token |
| / | GET | No token required |
- Create the database for tests:
sudo -u postgres createdb geolocation_api_test - Run the test in
/tests/modeltestsand/tests/controllertestsdir:go test -v - You can run all tests in
/testsgo test -v ./...