Skip to content

Commit cb7a520

Browse files
feat: add x-response-time response header 🤖
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
1 parent a3f0ba9 commit cb7a520

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"pbf": "3.2.1",
4040
"proj4": "2.8.1",
4141
"request": "2.88.2",
42+
"response-time": "^2.3.2",
4243
"sanitize-filename": "1.6.3",
4344
"sharp": "0.31.3",
4445
"tileserver-gl-styles": "2.0.0"

src/server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import express from 'express';
1515
import handlebars from 'handlebars';
1616
import SphericalMercator from '@mapbox/sphericalmercator';
1717
const mercator = new SphericalMercator();
18+
import responseTime from 'response-time';
1819
import morgan from 'morgan';
1920
import { serve_data } from './serve_data.js';
2021
import { serve_style } from './serve_style.js';
@@ -48,6 +49,7 @@ function start(opts) {
4849
fonts: {},
4950
};
5051

52+
app.use(responseTime({ suffix: false }));
5153
app.enable('trust proxy');
5254

5355
if (process.env.NODE_ENV !== 'test') {

0 commit comments

Comments
 (0)