node.js - How to manually serve files on Parse.com? -


i've deployed single-page app using frontend framework parse hosting.

however, there's huge issue in there: sub-paths routed /public folder, , there's index.html , bunch of assets in there.

i've tried numerous options on serving static index file through other routes, using express or http in cloud/main.js, seems parse runs custom subset of node modules. they've erased filesystem methods. there's no sendfile() on express api, no readfile()on fs module...

what can achieve that?? need paths not in public folder serve same thing: index.html file.


what i've tried:

read file , serve it:

app.use(function(req, res) {   fs.readfile('../public/index.html', 'utf8' , function(err, data) {     if (err) {       console.error(err);     }     res.send(data);   }); }); 

serve express middleware (probably efficient way):

app.use(function(req, res) {   res.sendfile('../public/index.html'); }); 

serve catch-all route:

app.get('*', function(req, res) {   res.sendfile('../public/index.html'); }); 


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -