Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gjbianco/metabolizer
express middleware to expose meta information
https://github.com/gjbianco/metabolizer
Last synced: about 1 month ago
JSON representation
express middleware to expose meta information
- Host: GitHub
- URL: https://github.com/gjbianco/metabolizer
- Owner: gjbianco
- Created: 2017-06-30T14:55:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-12T13:55:33.000Z (over 7 years ago)
- Last Synced: 2024-12-09T12:57:39.566Z (about 1 month ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# metabolizer
Express middleware to expose meta information
### Usage
Can use the `app.use()` Express syntax to hook up metabolizer.
Example:
```js
app.use('/version', require('metabolizer')(['name', 'version']));
```This exposes the `name` and `version` properties in `package.json` to the "/version" route. If you hit `/version`, you will get a JSON object with those values.
If you do not pass in a list, it will return just a version by default.
### Notes
If you want to expose a value from `package.json`, prepend the variable name with `npm_package_`. For example, if you wanted the package version, use the environment variable `npm_package_version`.
The values are determined at runtime. If the value somehow changes after startup, metabolizer WILL NOT use the new value. This is to keep the (already trivial) performance hit even smaller.