Skip to content

Instantly share code, notes, and snippets.

@flashvnn
Created June 7, 2022 05:46
Show Gist options
  • Save flashvnn/f155d595c30f586f605f2687b404c8f6 to your computer and use it in GitHub Desktop.
Save flashvnn/f155d595c30f586f605f2687b404c8f6 to your computer and use it in GitHub Desktop.
Totaljs http2
const spdy = require('spdy');
const fs = require('fs');
require('total4');
// Registers a route
ROUTE('GET /', function() {
// this === Controller
this.json({ message: 'Hello world' });
});
var handlerRequest = function(req, res) {
F.serverless(req, res)
}
const options = {
key: fs.readFileSync('./server.key'),
cert: fs.readFileSync('./server.crt')
};
spdy
.createServer(options, handlerRequest)
.listen(3000, (err) => {
if (err) {
throw new Error(err);
}
console.log('Listening on port: ' + 3000 + '.');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment