Skip to content

A simple REST API that provides CRUD operations on a hero object, it was built using Go and PostgreSQL.

License

Notifications You must be signed in to change notification settings

nicolaspearson/go.heroes.api

Repository files navigation

Go Heroes API

A simple REST API that provides CRUD operations on a hero object, it was built using Go and PostgreSQL.

Dependencies

This project makes use of gorilla/mux, gorm, and godotenv.

Getting Started

1. Clone the application

git clone https://github.com/nicolaspearson/go.heroes.api.git

2. Start the database

docker-compose up

3. Build and run the app

Run the app in development mode:

go run main.go

The app will start running at http://localhost:8000

Run the app in release mode:

go build
./go-hero

The app will start running at http://localhost:8000

Endpoints

The following endpoints are available:

POST /user/register
POST /user/login
GET /hero?id={heroId}
GET /heroes
POST /hero
PUT /hero/{heroId}
DELETE /hero/{heroId}

Benchmarking

Run this command to benchmark request performance:

wrk -d1m http://localhost:8000/heroes

benchmark

About

A simple REST API that provides CRUD operations on a hero object, it was built using Go and PostgreSQL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages