Skip to content

Commit

Permalink
vercel#369 Update examples to use res function
Browse files Browse the repository at this point in the history
  • Loading branch information
alisabzevari committed Feb 9, 2019
1 parent a91c85a commit 095e01f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/with-https/index.js
@@ -1,5 +1,5 @@
const https = require('https');
const { run, send } = require('micro');
const { run, res } = require('micro');

const { key, cert, passphrase } = require('openssl-self-signed-certificate');

Expand All @@ -10,9 +10,9 @@ const options = { key, cert, passphrase };
const microHttps = fn =>
https.createServer(options, (req, res) => run(req, res, fn));

const server = microHttps(async (req, res) => {
send(res, 200, { encrypted: req.client.encrypted });
});
const server = microHttps(async req =>
res({ encrypted: req.client.encrypted }, 200)
);

server.listen(PORT);
console.log(`Listening on https://localhost:${PORT}`);

0 comments on commit 095e01f

Please sign in to comment.