-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
111 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters