Serve UI5 SDK with Node Express
Serve static UI5 SDK files with Node Express.
Two response headers are useful for static files. They are cach-control and cors.
Two response headers are useful for static files. They are cach-control and cors.
const express = require('express');
// Constants
const PORT = 3000;
const HOST = '0.0.0.0';
// App
const app = express();
app.use ('/sdk', express.static (__dirname + "/sdk", {
maxAge:'180d',
etag:false,
setHeaders: (res, path, stat) => {
res.header('Access-Control-Allow-Origin', '*');
}
}))
app.listen(PORT, HOST);
console.log(`Running on http://${HOST}:${PORT}`);
Comments
Post a Comment