yeps-server
v1.1.3
Published
YEPS server
Downloads
12
Maintainers
Readme
YEPS server
It helps to run YEPS app as node.js server
How to install
npm i -S yeps-server
How to use
const App = require('yeps');
const server = require('yeps-server');
const error = require('yeps-error');
const logger = require('yeps-logger');
const app = new App();
app.all([,
error(),
logger(),
]);
Run server
server.createHttpServer(app);
Run with ssl/tls
const options = {
key: readFileSync(resolve(__dirname, 'ssl', 'key.pem')),
cert: readFileSync(resolve(__dirname, 'ssl', 'cert.pem'))
};
server.createHttpsServer(options, app);
With pem
npm i -S pem
app.js
const App = require('yeps');
const server = require('yeps-server');
const error = require('yeps-error');
const logger = require('yeps-logger');
const pem = require('pem');
const app = new App();
app.all([,
error(),
logger(),
]);
const days = 1;
const selfSigned = true;
pem.createCertificate({ days, selfSigned }, (err, { serviceKey: key, certificate: cert }) => {
if (err) {
throw err;
}
server.createHttpsServer({ key, cert }, app);
});