Skip to content

JoseJulianMosqueraFuli/go-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple API using Golang and Gin Framework

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.

Requirements

  • Docker Desktop (activated)
  • Golang

Getting Started

  1. Enter to the project directory:
git clone git@github.com:JoseJulianMosqueraFuli/go-api.git
  1. Enter to the project directory:
cd go-api
  1. Initialize the Go module:
go mod init myapi
  1. 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
  1. Build the project:
docker build
  1. Run the container:
docker up

The API will be accessible at http://localhost:8080/.

API Endpoints: Available endpoints

POST /register: Create a new registration user:

{
  'username' : '<username>',
  'password' : '<password>'
}

POST /login: Access user token:

{
  'username' : '<username>',
  'password' : '<password>'

}

POST /deliveries: Create a new delivery.

  • 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"
}

GET /deliveries/:id :

GET /deliveries/creator/:creatorID :

GET /deliveries:

POST /deliveries/by-date: :

POST /bots:

Author

Build it by Jose Julian Mosquera Fuli.

About

Simple API with GIN Golang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages