Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/eduardozepeda/go-coffee-api

Guadalajara speciality coffee shops API
https://github.com/eduardozepeda/go-coffee-api

Last synced: about 6 hours ago
JSON representation

Guadalajara speciality coffee shops API

Awesome Lists containing this project

README

        

# Go Coffee API

This is an API for coffee shops in Guadalajara. See details in the [Go Coffee API documentation](https://go-coffee-api.vercel.app/)

## Instructions for development

### Environmental variables

This project requires the following environmental variables set:

``` bash
JWT_SECRET=
DB_USER=
DB_PASSWORD=
DB_HOST=:
DB_PATH=
MODE=
GO_COFFEE_API_DSN=postgres://:@/
```

### Migrations

You need three things for the development process
- Postgres database
- [Golang Migrate tool](https://github.com/golang-migrate/migrate)
- An environmental variable called GO_COFFEE_API_DSN equal to the following postgres://:@/

#### Migrate

Once you got those things in place just run the following command.

``` bash
make migrate/up
```

If you want to do it manually you can run the following command, replacing the appropiate values

``` bash
migrate -path=./migrations -database postgres://:@/ up
```

#### Undo migrations

If you want to return the database to its initial state run the following command.

``` bash
make migrate/down
```

If you want to do it manually you can run the following command, replacing the appropiate values

``` bash
migrate -path=./migrations -database postgres://:@/ down
```

### Update docs

You need to have swag installed. The docs are installed in the docs directory, but you don't need to configurate anything, just run the following command.

``` bash
docs/generate
```

### Install npm packages

Install the required packages for vercel to work

``` bash
npm install
```

Install vercel package globally in case you don't have it

``` bash
npm i -g vercel
```

### Run Go and javascript server

Run golang and javascript server using vercel command.

``` bash
vercel dev
```

The previous command will run javascript and go server