Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gitkodev/pokemon-api

:unicorn::lion::monkey_face: Pokedex REST API created with GO and PostgreSQL
https://github.com/gitkodev/pokemon-api

clean-architecture docker go golang golang-api-examples mock-testing pokedex-api pokemon rest-api

Last synced: about 6 hours ago
JSON representation

:unicorn::lion::monkey_face: Pokedex REST API created with GO and PostgreSQL

Awesome Lists containing this project

README

        

# Go Pokedex REST API


Nest Logo

Pokedex REST API allows users to keep track of caught pokemon and their stats: `TYPE`, `HP`, `ATTACK`, and `DEFENSE`. The API utilizes JWT authentification for additional security as well as a number of other tools (look below). The projects structure implements `clean architecture` and `dependecy injection` principles

## Endpoints

#### API
- **/v1/pokemon  ** `=>`   **POST**   `=>`   Add pokemon
- **/v1/pokemon  ** `=>`   **GET**   `=>`   Get all pokemon
- **/v1/pokemon/{id}  ** `=>`   **GET**   `=>`   Get pokemon by id
- **/v1/pokemon/{id}  ** `=>`   **PUT**   `=>`   Update pokemon by id
- **/v1/pokemon/{id}  ** `=>`   **DELETE**   `=>`   Delete pokemon by id

#### Other
- **/health  ** `=>`   **GET**   `=>`   Ping the database connection
- **/auth/sign-up  ** `=>`   **POST**   `=>`   Create new pokemon trainer
- **/auth/sign-in  ** `=>`   **POST**   `=>`   Sign in with existing profile to generate JWT authentification token

## Tools used

- `App configuration`   **=>**   [Viper](https://github.com/spf13/viper)
- `Logging`   **=>**   [Logrus](https://github.com/sirupsen/logrus)
- `Routing`   **=>**   [Chi](https://github.com/go-chi/chi)
- `Database`   **=>**   Postgres + [pgx](https://github.com/jackc/pgx/)
- `Database migrations`   **=>**   [Goose](https://github.com/pressly/goose#sql-migrations)
- `Containerization`   **=>**   [Docker](http://docker.com/) + Docker Compose
- `Authentification and middleware`   **=>**   [JWT Go](https://github.com/golang-jwt/jwt)
- `Testing`   **=>**   [Sqlmock](https://github.com/DATA-DOG/go-sqlmock) + [Gomock](https://github.com/uber-go/mock) + [Testify](https://github.com/stretchr/testify)

## Installation
```
make initUp
```

## Running the app

```bash
# rebuild containers
make build

# start the app
make run

# run psql utility
make startPsql
```