seo - Static files served by node.js on heroku - is it a good idea? -


i have backbone powered single page app. app consists of couple of files:

index.html javascripts/app.js javascripts/vendor.js stylesheets/app.css images/ -> image assets 

i want add prerender.io service app make seo-friendly. easiest way of doing me use express.js hosted on heroku:

var express = require('express'); var app = express(); app.use(require('prerender-node').set('prerendertoken', 'your_token')); // ... app.listen(process.env.port || 5000); 

but maybe express or node not best serving static files? maybe heroku isn't best serving static files? best solution? recommend?

see stackoverflow question serving static files through expressjs: static files express.js

you should able use heroku's free dyno handle bit of traffic since you're serving static files.

i suggest putting of files/folder in "public/" directory , using code:

var express = require('express');  var app = express(); app.use(express.static(__dirname + '/public'));  app.listen(process.env.port || 3000); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -