f4b9ed39ab
* Don't EncodeURIComponent * Fix CORS * Explicitly define CORS header |
||
---|---|---|
.. | ||
db | ||
.gitignore | ||
Dockerfile | ||
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
To populate the database with seed data, run make setup-env
from oapen-engine/
Running with npm
npm ci
npm start
Endpoints
-
Endpoint: /GET http://localhost:3001/api/{handle}
-
Endpoint: /GET http://localhost:3001/api/{handle}/?threshold={integer}
-
Endpoint: /GET http://localhost:3001/api/{handle}/ngrams