https://github.com/kth/node-api
Node API is the backend service for node-web. It is also a template for Node API applications developed at KTH.
https://github.com/kth/node-api
Last synced: 8 months ago
JSON representation
Node API is the backend service for node-web. It is also a template for Node API applications developed at KTH.
- Host: GitHub
- URL: https://github.com/kth/node-api
- Owner: KTH
- License: mit
- Created: 2016-08-31T08:49:56.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2025-07-09T02:40:59.000Z (11 months ago)
- Last Synced: 2025-07-09T03:35:17.016Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.77 MB
- Stars: 0
- Watchers: 20
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Node API
## Description
Node API is the backend service for [node-web](https://github.com/KTH/node-web). It is also a template for Node API applications developed at KTH.
## Installation
### Install Dependencies
```sh
$ npm install
```
### Environment Variables
Sensible defaults are set and the application can run locally with an empty `.env` file.
| Name | Description | Default Value |
| -------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------- |
| `API_KEYS` | Configuration for access to API; string with name, key, and scope | `?name=devClient&apiKey=1234&scope=write&scope=read` |
| `LOGGING_ACCESS_LOG` | Enables or disabled application access log, used by dependency `kth-node-access-log` | `true` |
| `LOGGING_LEVEL` | Application logging level, used by dependency `@kth/log` | `debug` |
| `MONGODB_URI` | Document database connection string | `mongodb://127.0.0.1:27017/node` |
| `SERVER_PORT` | The HTTP server port | `3001` |
| `SERVICE_PUBLISH` | Root path for the application | `/api/node` |
### Local Databases
- It is recommended to use a local document database with [kth-node-backend](https://github.com/KTH/kth-node-backend)
## Usage
Start the application in local development mode:
```sh
$ npm run start-dev
```
Access the Swagger UI on [localhost:3001/api/node/swagger](http://localhost:3001/api/node/swagger/index.html). Authorize with API key set with environment variable `API_KEYS`. Default value is `1234`.
## Running Tests
Tests are setup with [Jest](https://jestjs.io/). Run them with:
```
$ npm test
```
## Contact
Node API is developed and maintained by [Team KTH Web](https://github.com/orgs/KTH/teams/web-team).