oapen-suggestion-service/api
j-sofia ccbdda287e
OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9)
* 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
2022-10-26 03:07:10 +00:00
..
db OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9) 2022-10-26 03:07:10 +00:00
.gitignore OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9) 2022-10-26 03:07:10 +00:00
README.md OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9) 2022-10-26 03:07:10 +00:00
app.js OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9) 2022-10-26 03:07:10 +00:00
config.env OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9) 2022-10-26 03:07:10 +00:00
package-lock.json OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9) 2022-10-26 03:07:10 +00:00
package.json OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9) 2022-10-26 03:07:10 +00:00
routes.js OAP-17: PostgreSQL integration into API with pg-promise, data function to read from DB, dotenv to read DB credentials from environment variables (#9) 2022-10-26 03:07:10 +00:00
validate.js Split API from demo app and began Express framework (#7) 2022-10-06 18:49:58 +00:00

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/