_x000D_
/**_x000D_
* Allow cross origin to access our /public directory from any site._x000D_
* Make sure this header option is defined before defining of static path to /public directory_x000D_
*/_x000D_
expressApp.use('/public',function(req, res, next) {_x000D_
res.setHeader("Access-Control-Allow-Origin", "*");_x000D_
// Request headers you wish to allow_x000D_
res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");_x000D_
// Set to true if you need the website to include cookies in the requests sent_x000D_
res.setHeader('Access-Control-Allow-Credentials', true);_x000D_
// Pass to next layer of middleware_x000D_
next();_x000D_
});_x000D_
_x000D_
_x000D_
/**_x000D_
* Server is about set up. Now track for css/js/images request from the _x000D_
* browser directly. Send static resources from "./public" directory. _x000D_
*/_x000D_
expressApp.use('/public', express.static(path.join(__dirname, 'public')));
_x000D_
If you want to set Access-Control-Allow-Origin to a specific static directory you can set the following.
_x000D_