This is a simple API built using the Golang programming language and the Gin web framework. The API provides an endpoint for creating and managing deliveries.
- Docker Desktop (activated)
- Golang
- Enter to the project directory:
git clone git@github.com:JoseJulianMosqueraFuli/go-api.git
- Enter to the project directory:
cd go-api
- Initialize the Go module:
go mod init myapi
- Install the required dependencies:
go get -u github.com/gin-gonic/gin
go get -u github.com/jinzhu/gorm
go get -u github.com/jinzhu/gorm/dialects/postgres
go get -u github.com/google/uuid
go get -u github.com/dgrijalva/jwt-go
- Build the project:
docker build
- Run the container:
docker up
The API will be accessible at http://localhost:8080/.
{
'username' : '<username>',
'password' : '<password>'
}
{
'username' : '<username>',
'password' : '<password>'
}
- Example JSON request body:
{
"id": "1234567890",
"state": "pending",
"pickup": {
"pickup_lat": 37.7749,
"pickup_lon": -122.4194
},
"dropoff": {
"dropoff_lat": 34.0522,
"dropoff_lon": -118.2437
},
"zone_id": "zone123"
}
Build it by Jose Julian Mosquera Fuli.