X-Frame-Options, Strict-Transport-Security, Referrer-Policy, X-XSS-Protectionconst {HttpServer} = require('@aliceo2/web-ui');
HttpServer({port: PORT, hostname: HOSTNAME, tls: TLS_ENABLED, portSecure: HTTPS_PORT, key: TLS_KEY, cert: TLS_CERT, autoListen: AUTO_LISTEN}, JWT_CONF, OPENID_CONF);
Where:
HTTP_CONF consists of following fields:
PORT - HTTP port numberHOSTNAME] - server’s hostname which is required by Content Security Policy (default: localhost)TLS_ENABLED] - flag that enables/disables TLS (default: false)HTTPS_PORT] - HTTPS port number, TLS must be enabledTLS_KEY] - private key filepath, TLS must be enabledTLS_CERT] - certificate filepath, TLS must be enabledAUTO_LISTEN] - flag that enables/disables automatic listening (default: true)LIMIT] - controls the maximum request body size. Defaults to ‘100kb’.JWT_CONF] - JWT module config, see JWT moduleOPENID_CONF] - OpenID config, see OpenID Connect modulelisten
close
address
addStaticPath
get
post
put
patch
delete
// Include required modules
const {HttpServer} = require('@aliceo2/web-ui');
// create instance of http server
const http = new HttpServer({
port: 8080
});
// Server `public` folder
http.addStaticPath('public');
http.get('/hi', (req, res) => {
res.status(200).json({message: 'hi'})
}, { public: true }); // turns off JWT verification