UNPKG

3.75 kBMarkdownView Raw
1# ⚛️ Protomodule | Probe
2**for NodeJS / Express based applications**
3
4 [![NPM Version][npm-version-image]][npm-url]
5 [![NPM Install Size][npm-install-size-image]][npm-install-size-url]
6 [![NPM Downloads][npm-downloads-image]][npm-downloads-url]
7
8*Protomodule* is a set of common practices which span from coding over CI/CD to production deployments. Every utility within Protomodule is able to provide core functionality as a standalone tool. All Protomodule utilities are interoperable to get the most out of your DevOps pipeline with minimum effort.
9
10*Probe* is the NodeJS module to integrate Protomodules principles into [NodeJS](https://nodejs.org/en/) / [Express](http://expressjs.com) based applications.
11
12**🚨 This library is under heavy development.** Be sure to check back for breaking changes in future releases.
13
14## Quick start guide
15
16Install *Protomodule | Probe* by running:
17
18```console
19$ npm install --save @protomodule/probe
20```
21
22Integrate *Protomodule | Probe* into your express setup with a single line of code:
23
24**⚠️ Be aware: Add Protomodule | Probe before you add all your other routes/middlewares in order to function correctly.** All routes/middlewares added before calling the Protomodule initializer are exluded from protomodules features.
25
26```js
27import { useProtomoduleIn } from "@protomodule/probe"
28
29const app = express()
30useProtomoduleIn(app)
31
32// Add your routes here
33```
34
35## Features
36
37*Protomodule | Probe* provides two kinds of features:
38
39### Modules
40
41Modules are automatically applied middlewares for express. The may be deactivated by configuration.
42
43 * [Version](docs/version.md)
44 * [Changelog](docs/changelog.md)
45 * [Metrics](docs/metrics.md)
46 * [Request Logging](docs/request-logging.md)
47 * [Request Tracing](docs/tracing.md)
48
49### Utilities
50
51Must be explicitly used.
52
53 * [Environment variables](docs/config.md)
54 * [Logging](docs/log.md)
55
56## Configuration options
57
58Modules can be configured in the `useProtomoduleIn(...)` call. First parameter of this function takes an Express app. Through the [**rest** arguments](https://www.typescriptlang.org/docs/handbook/type-compatibility.html#optional-parameters-and-rest-parameters) an arbitrary number of options can be specified.
59
60You can pass in plain objects or use predefined options imported from `@protomodule/probe`.
61
62Be aware that all options are merged in the following priority:
63
64 1. Specific environment variables overwrite
65 1. Options as parameters (parameters are merged from first to last)
66 1. Default fallback values
67
68*Example configuration*
69```js
70import { useProtomoduleIn, withoutRequestLogging } from "@protomodule/probe"
71
72...
73useProtomoduleIn(app, withoutRequestLogging)
74```
75
76Read more about available options in the [options](docs/options.md) section.
77
78## How to contribute
79
80Please use pull requests for new feature suggestions. During development run `yarn watch` to automatically re-compile on code changes. For releases to NPM run:
81
82```
83$ yarn build
84$ yarn release
85```
86
87## Credits
88
89## License
90
91This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file.
92
93> This project is in no way affiliated with Apple Inc or Google Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs.
94
95[npm-downloads-image]: https://badgen.net/npm/dm/@protomodule/probe
96[npm-downloads-url]: https://npmcharts.com/compare/@protomodule/probe?minimal=true
97[npm-install-size-image]: https://badgen.net/packagephobia/install/@protomodule/probe
98[npm-install-size-url]: https://packagephobia.com/result?p=@protomodule/probe
99[npm-url]: https://npmjs.org/package/@protomodule/probe
100[npm-version-image]: https://badgen.net/npm/v/@protomodule/probe