command
module
Version:
v0.0.0-...-c877efe
Opens a new window with list of versions in this module.
Published: Mar 31, 2022
License: MIT
Opens a new window with license information.
Imports: 12
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
NFL Looser Pool REST API
REST API for NFL Looser Pool game
Getting Started
-
Install Postgres, Docker, and Go.
-
Install the Docker app launch it
-
Install the Postgres app and launch it using port 5432
-
You'll need to set up a .env
file to store your PostgreSQL information. Here is an example:
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
DB_HOST=host.docker.internal
export POSTGRESQL_URL="postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable"
Note: POSTGRESQL_URL is not being used in the program, but we can reference this variable in our db migration commands
-
create schemas migrate create -ext sql -dir db/migrations -seq create_items_table
-
Run Database Migrations
migrate -database postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable -path db/migrations up
or
export POSTGRESQL_URL="postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable"
migrate -database ${POSTGRESQL_URL} -path db/migrations up
migrate -database postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable -path db/migrations down
-
To dig into Postgresql, you can use psql
-
run docker-compose up --build
to launch the api server on port 8080
Before you run this command, be sure your local postgres server is running using the postgres app
-
run docker-compose down
to destroy Docker containers
-
Create a sample item
curl -X POST http://localhost:8080/items -H "Content-type: application/json" -d '{ "name": "swim across the River Benue", "description": "ho ho ho"}'
curl http://localhost:8080/items
Scripts
dev
- starts the local docker container for local dev
kill-postgres
kills postgres running ports / servers
db:down
- drops the database
db:up
- runs database migrations
db:down:up:dev
- drops the database, runs migrations and starts the docker container / server
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.