Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I am building a single page web application with Express.js on the back-end. However, I want to keep the login/register/homepage to the application (before you login) separate from the single page application (after you login), but on the same root URL (/).

My question is how would you recommend designing this? Currently I have server-side templates rendered and served by routes in Express.js for /, /login, and /register (because I don't want the pre-app part of the web site to be appy). Then, when the user logs in, I serve a different server-side template to the / GET route:

app.get('/', function (req, res) {
  if (!req.isAuthenticated()) {
    return res.render('index');
  }

  res.render('app')
})

This file then serves the rest of the application by providing a link to the client-side JavaScript (Backbone.js/AngularJS, etc.)

I am looking to receive criticism on this design. Is this the best way for me to achieve my desired application design, using Express.js and a mix of client/server-side templates?

share|improve this question
    
This question appears to be off-topic because it is about an application design, while there is no code to review. This would be best for Programmers SE. –  Jamal Dec 16 '13 at 2:00
add comment

closed as off-topic by Jamal Dec 16 '13 at 2:00

  • This question does not appear to be a code review request within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.