Skip to content

Serving static files

Mohsen Esmaeili edited this page Jul 26, 2018 · 1 revision

📁 Serving static files

To serve static files such as images, CSS files, and JavaScript files

NOTE: For best results, use CDN such as 🌐cloudflare or reverse proxy such as 🌐redbird cache to improve performance of serving static assets.

var serendip = require('serendip');
var path = require('path');

serendip.start({

    cpuCores: 1,
    httpPort: 3000,

    //// Serving static files from  D:\ drive
    // staticPath: 'D:\\'

    // Serving from public folder
       staticPath: path.join(__dirname,'public')

}).then(() => {
    console.log('Server started!');
}).catch((e) => {
    console.error(e);
});
Clone this wiki locally