# @scholten.dev/api-base

> ## services/configuration

Latest version **0.8.0** (published 2022-04-10) · 0 weekly downloads

## Install

```sh
npm install @scholten.dev/api-base
pnpm add @scholten.dev/api-base
yarn add @scholten.dev/api-base
bun add @scholten.dev/api-base
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.0 |
| Published | 2022-04-10 |
| First published | 2021-10-04 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 16.9 KB |
| Known vulnerabilities | 0 (+5 in 3 direct dependencies) |
| Install scripts | no |
| Maintainers | scholten |

## Links

- npm: https://www.npmjs.com/package/@scholten.dev/api-base
- npm.io page: https://npm.io/package/@scholten.dev/api-base

## Dependencies (12)

- [fs](https://npm.io/package/fs.md) 0.0.1-security
- [ajv](https://npm.io/package/ajv.md) ^7.1.0
- [cors](https://npm.io/package/cors.md) ^2.8.5
- [express](https://npm.io/package/express.md) ^4.17.1
- [mongodb](https://npm.io/package/mongodb.md) ^3.7.2
- [@types/ajv](https://npm.io/package/@types/ajv.md) ^1.0.0
- [typescript](https://npm.io/package/typescript.md) ^4.4.3
- [body-parser](https://npm.io/package/body-parser.md) ^1.18.3
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^8.5.1
- [express-fileupload](https://npm.io/package/express-fileupload.md) ^1.3.1
- [@types/jsonwebtoken](https://npm.io/package/@types/jsonwebtoken.md) ^8.5.5
- [@types/express-fileupload](https://npm.io/package/@types/express-fileupload.md) ^1.2.2

## Recent versions

- 0.8.0 (latest) — 2022-04-10
- 0.7.0 — 2022-04-10
- 0.6.0 — 2022-04-09
- 0.5.0 — 2022-04-08
- 0.4.2 — 2022-03-25
- 0.4.1 — 2022-03-25
- 0.4.0 — 2022-03-25
- 0.3.2 — 2022-03-25
- 0.3.1 — 2021-12-21
- 0.3.0 — 2021-10-29
- 0.2.5 — 2021-10-10
- 0.2.4 — 2021-10-10
- 0.2.3 — 2021-10-10
- 0.2.2 — 2021-10-10
- 0.1.2 — 2021-10-10
- … 3 more at https://npm.io/package/@scholten.dev/api-base/versions

## README

# Api base

## services/configuration

Configuration service will try to map environment variables to an existing configuration class.

If the environment variable doesn't exist, the already existing value in the baseConfig will be used.

If the type is not matching, an error will be thrown.

Note: environment variables must be prefixed with CONFIG_. Example: `CONFIG_credentials_password=myPassword`

``` typescript
import {Configuration} from @scholten.dev/api-base

interface IConfig {
    devMode: boolean;
    credentials: {
        username: string;
        password: string;
    }
}

const baseConfig: IConfig = {
    devMode: true,
    credentials: {
        username: "user"
        password: "pass"
    }
}

const config = Configuration<IConfig>(baseConfig);
```

## Health check
get /api/healthz

---
_Source: https://npm.io/package/@scholten.dev/api-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
