HUB
Sign inSign up

gdnws/accounts-api

By gdnws

•Updated almost 7 years ago

Good News! Accounts API

Image
0

786

gdnws/accounts-api repository overview

⁠Accounts API

API for managing Good News user accounts.

⁠Setup

⁠Setup Environment Variables

Setup GOPATH and GOBIN environment variables:

export GOPATH=$(pwd)/src
export GOBIN=$GOPATH/bin

Set the environment variables for postgres and application secret:

DB_HOST=
DB_USER=
DB_PASS=
DB_NAME=
SCHEMA=
JWT_KEY=
⁠Setup Postgres:

The database should have a users table like so:

create table users
(
	id serial not null
		constraint users_pk
			primary key,
	email varchar(255) not null,
	password varchar(255) not null,
	refresh_token varchar(255),
	created_at timestamp default CURRENT_TIMESTAMP not null,
	updated_at timestamp default CURRENT_TIMESTAMP
);

create unique index users_email_uindex
	on users (email);

⁠Build

cd ./src && go build -a -installsuffix cgo -o main .

⁠Run

./src/main

⁠Deploy

Build and tag the docker image. Or run with:

docker-compose up --build -d
Tag summary
Recent tags
Content type
Image
Digest
Size
7.4 MB
Last updated
almost 7 years ago
docker pull gdnws/accounts-api:latest