-
Notifications
You must be signed in to change notification settings - Fork 0
/
okapi.js
33 lines (27 loc) · 894 Bytes
/
okapi.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
25
26
27
28
29
30
31
32
33
var compression = require('compression');
var cors = require('cors');
var express = require('express');
var server = express();
server.use(cors());
server.use(compression());
server.use(express.json({ limit: '50mb' }));
server.use(express.urlencoded({ extended: true }))
const PORT = 9130;
const HOST = 'localhost';
const BASE_HREF = '/';
server.post('/authn/login', function (req, res) {
console.log(JSON.stringify(req.body));
console.log(req.headers);
res.setHeader('Content-Type', 'application/json');
res.setHeader('X-Okapi-Token', 'TOKEN');
res.send({});
});
server.post('/user-import', function (req, res) {
console.log(JSON.stringify(req.body));
console.log(req.headers);
res.setHeader('Content-Type', 'application/json');
res.send({});
});
server.listen(PORT, HOST, () => {
console.log(`Mock Okapi server listening on http://${HOST}:${PORT}${BASE_HREF}`);
});