[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could not understand where should I put app.use(...). #3

Open
AttilaSATAN opened this issue May 21, 2014 · 7 comments
Open

could not understand where should I put app.use(...). #3

AttilaSATAN opened this issue May 21, 2014 · 7 comments

Comments

@AttilaSATAN
Copy link

If I'm mistaken please correct me but isn't app.use(app.router) removed from Express 4.

https://github.com/visionmedia/express/wiki/Migrating-from-3.x-to-4.x

And if I'm not mistaken again, MEAN is using Exp. 4
Therefore there is no line of app.use(app.router)

then where should I put app.use(seo...)?

app.use(seo({
    cacheClient: 'disk', // Can be 'disk' or 'redis'
    cacheDuration: 2 * 60 * 60 * 24 * 1000, // In milliseconds for disk cache
}));

// app.use(app.router) will be below this line 
@AttilaSATAN AttilaSATAN reopened this May 21, 2014
rschwabco pushed a commit that referenced this issue Oct 11, 2014
@maciekpaprocki
Copy link

I also just spend few hours trying to solve that. Is there any way to get update on instruction? is it even working with new express version?

I would highly appreciate some help.

@wesleyfsmith
Copy link

Same problem here, I'd love to know where to put the app.use() line. Thanks!

@apitts
Copy link
apitts commented Feb 11, 2015

I too am struggling to work out where to put mean-seo in express.js post the upgrade to express 4.0. I have added in here:

// Setting the app router and static folder
app.use(express.static(path.resolve('./public')));

//See https://github.com/meanjs/mean-seo
app.use(seo({
cacheClient: 'disk', // Can be 'disk' or 'redis'
cacheDuration: 2 * 60 * 60 * 24 * 1000, // In milliseconds for disk cache
}));

// Globbing routing files
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
    require(path.resolve(routePath))(app);
});

However, mean-seo does not seem to be working as Google is still not caching my page - a search for Polinode and checking cached shows a blank page.

@wesleyfsmith
Copy link

@apitts, that is the correct place to add it. It's working for me. It took a while before google updated the search results.

If you sign up for the google webmaster tools, you can append the escaped fragment to the end of your website url and see if you are getting results. If so, it is working and will just take time for your ranking to improve in my experience.

@apitts
Copy link
apitts commented Feb 12, 2015

Thanks @wesleyfsmith - appreciate it! Yep - I think my issue was actually SSL related, which is fixed now. It's still not rendering all my content so have another issue to solve yet...but certainly getting closer.

@imomin
Copy link
imomin commented Aug 28, 2015

This is what I did and it seems to be working.... when I do curl http://localhost:9000/users/1?_escaped_fragment_=

// Setup server
var app = express();
var server = require('http').createServer(app);
var socketio = require('socket.io')(server, {
serveClient: (config.env === 'production') ? false : true,
path: '/socket.io'
});
require('./config/socketio')(socketio);
require('./config/express')(app);

app.use(seo({
cacheClient: 'disk', // Can be 'disk' or 'redis'
cacheDuration: 2 * 60 * 60 * 24 * 1000, // In milliseconds for disk cache
}));

require('./routes')(app);
require('./config/conference')(app,socketio);

@kybarg
Copy link
kybarg commented Jan 14, 2017

/config/lib/express.js
Before module.exports.init = function (db) { ~ line 220

/**
 * Configure seo See https://yandex.ru/support/webmaster/robot-workings/ajax-indexing.xml
 */
module.exports.initModulesSeo = function (app) {
  app.use(seo({
    cacheClient: 'disk', // Can be 'disk' or 'redis'
    cacheDuration: 0 // In milliseconds for disk cache
  }));
};

Then before this.initModulesServerRoutes(app);

this.initModulesSeo(app);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants