service-name
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

service-name

service-name

Overview

service-name provides a simple express/connect middleware for appending the project's version as an x-version header to all specified requests.

Usage

Just like above:

import serviceName from 'service-name';
import express from 'express';

const app = express();

app.use(serviceName());

Import the module and use it. It works with CJS require as well. This configuration will produce the following HTTP-Response-Header for all routes, if the package.json file has this version field:

{
  "name": "awesome-service"
}
HTTP/1.1 200 OK
X-Powered-By: Express
x-name: awesome-service
Content-Type: application/json; charset=utf-8
Content-Length: 13
ETag: W/"d-jYIVkMttA3gZvYs6yuMWCdh78+w"
Date: Sat, 10 Mar 2018 17:53:25 GMT
Connection: keep-alive

(You can use curl to reproduce this log: curl http://localhost/ -I)

Have fun coding!

Readme

Keywords

none

Package Sidebar

Install

npm i service-name

Weekly Downloads

22

Version

1.4.1

License

Apache-2.0

Unpacked Size

82.8 kB

Total Files

4

Last publish

Collaborators

  • nicolaischmid