Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oleg-koval/koa-verto
Middleware for Koa that adds version header (x-version) to the response
https://github.com/oleg-koval/koa-verto
hacktoberfest hacktoberfest2021 header koa koa-version-header middleware nodejs npm response service x-name x-version
Last synced: 22 days ago
JSON representation
Middleware for Koa that adds version header (x-version) to the response
- Host: GitHub
- URL: https://github.com/oleg-koval/koa-verto
- Owner: oleg-koval
- License: mit
- Created: 2018-08-22T15:52:12.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-20T17:33:19.000Z (over 1 year ago)
- Last Synced: 2024-10-05T01:32:15.073Z (about 1 month ago)
- Topics: hacktoberfest, hacktoberfest2021, header, koa, koa-version-header, middleware, nodejs, npm, response, service, x-name, x-version
- Language: JavaScript
- Homepage:
- Size: 1.27 MB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: readme.md
- Changelog: CHANGELOG.md
- Contributing: contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# koa-verto
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/29f657a1d6484ec5bd4bb76f02fc73fc)](https://app.codacy.com/app/oleg-koval/koa-verto?utm_source=github.com&utm_medium=referral&utm_content=oleg-koval/koa-verto&utm_campaign=Badge_Grade_Dashboard)
[![Package Quality][pq-image]][pq-link]
[![CircleCI][ci-image]][ci-url]
[![Coverage Status][coveralls-image]][coveralls-url]
[![linted by sexy yo!][sexy-image]][sexy-url]
[![semantic-release][semantic-image]][semantic-url]> Middleware that adds headers `X-Service-Name` & `X-Service-Version` to the response of [Koa][koalink]. Inspired by [koa-version-header][koa-version-header-link]
Tested with:
- Koa version `2.5.2`
- Node versions:
- 10
- 9
- 8## Installation
This is a [Node.js][nodejslink] module available through the
[npm registry][npmlink]. It can be installed using the
[`npm`](https://docs.npmjs.com/getting-started/installing-npm-packages-locally)
or
[`yarn`][yarnlink]
command line tools.```sh
npm install koa-verto --save
```## Usage
```javascript
const Koa = require('koa');
const setVersionHeaders = require('koa-verto');const app = new Koa();
app.use(setVersionHeaders());
app.listen(3000);
console.log('running on :3000, verify X-Service-Name, X-Service-Version headers')
```If you want to specify custom service `name` or `version`:
```javascript
app.use(setVersionHeaders({
name: 'my-cool-app',
version: 'v11.1.2-alpha'
}));
```## Tests
```sh
npm install
npm test
```## License
MIT
Copyright 2018 <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[koalink]:https://github.com/koajs/koa
[nodejslink]:https://nodejs.org/
[npmlink]:https://www.npmjs.com/
[yarnlink]:https://yarnpkg.com/en/
[npm-icon]:https://nodei.co/npm/koa-verto.png?downloads=true
[npm-url]:https://npmjs.org/package/koa-verto
[ci-image]:https://github.com/oleg-koval/koa-verto/workflows/Continuous%20Integration/badge.svg?branch=master
[ci-url]:https://github.com/oleg-koval/koa-verto/actions
[sexy-image]:https://img.shields.io/badge/linted%20by-sexy%20yo!-brightgreen.svg
[sexy-url]:https://github.com/markelog/eslint-config-sexy
[semantic-image]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[semantic-url]:https://github.com/semantic-release/semantic-release
[koa-version-header-link]:https://github.com/bahmutov/koa-version-header
[pq-image]:http://npm.packagequality.com/shield/koa-verto.svg
[pq-link]:http://packagequality.com/#?package=koa-verto
[coveralls-image]:https://coveralls.io/repos/github/oleg-koval/koa-verto/badge.svg?branch=master
[coveralls-url]:https://coveralls.io/github/oleg-koval/koa-verto?branch=add-code-coverage