README
NLP API Server
This is the backend REST API for NLP powered by NodeJS and MongoDB
Prerequisites
- node >= 16
- docker
Getting Started
First, install packages and start the MongoDB Docker container:
$ npm install
$ npm run start:mongo
Developing
Environment variables (DB connection strings, etc.) are set using a .env
file. For development, copy the contents of .env.local
into a .env
file before
starting the server.
Curious about why .env
isn't version controlled? Refer here.
Next, start the hot reload dev server with the following:
$ npm run dev
Debugging
To make debugging automatic for vscode users, a .vscode/launch.json
file is tracked in source control. Ctrl+Shift+D
should show Launch via NPM (nlp-api-server)
as a selection in the debug environments dropdown.
Testing
Run tests with the npm
script:
$ npm test
Debugging Tests
For vscode users, Ctrl+Shift+D
should show Mocha Tests (nlp-api-server)
as a selection in the debug environments dropdown.
Building
To transpile TypeScript source into JavaScript, run the following:
$ npm run build
Node can than be used directly to start the server (without hot reloading):
$ npm run start:node
The Package (@aivec/nlp-api-server)
This repo exposes certain TypeScript types/interfaces as an npm
package. All files in the ./types
folder are included in the tarball when running npm publish
. Note that the contents of this package are subject to change at any time..