ccbdda287e
* local db connection and data functions added pg-promise package to interface with PostgreSQL, added data functions, changed api to port 3001, updated README.md * pr review changes * dotenv * Update README.md with api dependencies * Update README.md * PR changes * typo |
||
---|---|---|
.. | ||
db | ||
.gitignore | ||
README.md | ||
app.js | ||
config.env | ||
package-lock.json | ||
package.json | ||
routes.js | ||
validate.js |
README.md
OAPEN Suggestion API
About
A basic Node.js + Express api using pg-promise to interface with PostgreSQL and dotenv to read environment variables
Database Configuration
To configure the database connection, create a file called config.env
in api/
with the contents
DATABASE_URL="postgres://username:password@host:port/database"
PORT=PORT_NUMBER
e.g.
DATABASE_URL="postgres://postgres:password@localhost:5432/postgres"
PORT=3001
Running with npm
npm ci
npm run clean
npm start
Endpoint: /GET http://localhost:3001/api/{item_uuid}
e.g. http://localhost:3001/api/a91a6b7d-874a-4144-b44d-0da647a82acc
To populate the database with seed data, run make setup-env
from oapen-engine/