Skip to content

Instantly share code, notes, and snippets.

@flashvnn
Created June 29, 2021 06:35
Show Gist options
  • Save flashvnn/40bbdb51993eb38555e56ed4ca851426 to your computer and use it in GitHub Desktop.
Save flashvnn/40bbdb51993eb38555e56ed4ca851426 to your computer and use it in GitHub Desktop.
Totaljs Serverless
require('total4');
const serverless = require('serverless-http');
async function Server(req, res, options) {
F.console = NOOP;
return new Promise(function (resolve, reject) {
F.custom('prod', undefined, req, res, options, () => resolve(true));
})
}
const app = async function (req, res) {
await Server(req, res, { directory: __dirname });
F.listener(req, res);
}
module.exports.handler = serverless(app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment