forked from openzipkin/zipkin-browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-server.js
24 lines (22 loc) · 817 Bytes
/
test-server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// This is a simple server that returns a JSON of all the
// request headers that were sent. (Useful for seeing the
// effects of the chrome extension)
const express = require('express');
const app = express();
const port = 8080;
app.get('/config.json', (req, res) => {
res.json({
instrumented: ['*://example.com/**', '**']
});
});
app.get('*', (req, res) => {
console.log('req', req.headers);
res.header('Access-Control-Allow-Origin', '*');
res.header("Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
res.header("Access-Control-Allow-Methods", "GET, PUT, POST");
console.log('res', res.headers);
res.json(req.headers);
});
app.listen(port, () => {
console.log(`zipkin-chrome-extension test server running on port ${port}`);
});