I built a really simple multi-page Express.js app for a client with some forms. But now after I've applied a bunch of CSS to it and been getting it ready to deliver, I've been getting some bizarre behavior on localhost. When I push the site up, everything acts as a link to the "About Us" view. When I click on an image, when I click on an input field in the "Contact Us" form, even tagged text, it all redirects me to the "About Us" view.
Here's my config settings:
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({ secret: 'botheredbybronies' }));
app.use(app.router);
app.use(express.static(__dirname + '/public'));
app.use(express.favicon(__dirname + '/public/images/aquifavicon1.svg'));
});
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
And here's the route in question, nothing special about it:
app.get('/about', function (req, res, next) {
res.render('about', {title: 'About Aqui'});
});
I just want to understand what is causing this. If you have any ideas, your help is much appreciated.
Obviously the problem is with the pages you're serving (i.e. everything turns into a link).
Either you have some global onClick
handler on your page, or (more likely) some <a href="...">
tag was not closed (turning everything until the end of the page or the next <a href="...">
link into a link).
You can check it in Chrome by selecting "Inspect element" from the text unexpectedly acting as a link and checking for onClick
event listeners or <a href="...">
elements up in the DOM tree.
It is hard to say anything more than that without looking at the rendered page.