Skip to content

Latest commit

 

History

History
62 lines (52 loc) · 1.34 KB

database.md

File metadata and controls

62 lines (52 loc) · 1.34 KB

Database Instructions

If you want to use this project with the provided database, follow this steps.

Create db

First you have do create a database named "resto". You can do it manually with to command below (adjust with you own information);

psql -U postgres
CREATE USER you-user LOGIN PASSWORD 'your-password';
CREATE DATABASE resto OWNER your-user;

Create .env file

Copy / Past the .env.example file and rename it .env Then, inside modify the different PG variables with your own data

PORT=3000

PGHOST='host'
PGUSER='POSTGRES USER'
PGDATABASE='resto'
PGPASSWORD='PASSWORD'
PGPORT= POSTGRES PORT

API_DOCUMENTATION_ROUTE=/docs
CORS_DOMAINS=

Create sqitch.conf file

Copy / Past the sqitch.conf.example file and rename it sqitch.conf Then, inside modify it like that :

[core]
	engine = pg
	top_dir = migrations
	# plan_file = migrations/sqitch.plan
[engine "pg"]
	target = db:pg:resto
	# registry = sqitch
	# client = psql

Install dependencies

Run the following command to install dependencies

npm install

Create an seed databse

Now we are ready to create all tables and add some entries inside. Make sure to be into root folder of the app and run this command

npm run resetDB

Now you can follow instruction on readme.md directly on "add routes" section.