Some checks are pending
Automatisch Backend Tests / test (push) Waiting to run
Automatisch CI / linter (push) Waiting to run
Automatisch CI / start-backend-server (push) Waiting to run
Automatisch CI / start-backend-worker (push) Waiting to run
Automatisch CI / build-web (push) Waiting to run
Automatisch UI Tests / test (push) Waiting to run
29 lines
725 B
JavaScript
29 lines
725 B
JavaScript
const fs = require('node:fs');
|
|
const https = require('node:https');
|
|
const path = require('node:path');
|
|
const { run, send } = require('micro');
|
|
|
|
const options = {
|
|
key: fs.readFileSync(path.join(__dirname, './automatisch.io+4-key.pem')),
|
|
cert: fs.readFileSync(path.join(__dirname, './automatisch.io+4.pem')),
|
|
};
|
|
|
|
const microHttps = (fn) =>
|
|
https.createServer(options, (req, res) => run(req, res, fn));
|
|
|
|
const server = microHttps(async (req, res) => {
|
|
const data = {
|
|
id: '7f22d7dd-1fda-4482-83fa-f35bf974a21f',
|
|
name: 'Mocked license',
|
|
expireAt: '2030-08-09T10:56:54.144Z',
|
|
};
|
|
|
|
send(res, 200, data);
|
|
});
|
|
|
|
server
|
|
.once('listening', () => {
|
|
console.log('The mock server is up.');
|
|
})
|
|
.listen(443);
|