Nodejs piptcode - can't make it work

I bought the latest pupcode nodejs tutorial and followed it, however I cannot go through the previous step.

I get upset after spending several hours to find out where I got the error, since debugging nodejs is a mystery to me.

Application structure

as follows:

example 
  |__public
  |__views
  |__assets 
  |__apps <- instead of routes
  server.js
  package.json

Here is my simple code:

server.js

/**
 * Module dependencies.
 */
require('coffee-script');

var express = require('express');
var app = module.exports = express.createServer();

// Configuration
app.configure(function(){
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(__dirname + '/public'));
});

app.configure('development', function(){
  app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});

app.configure('production', function(){
  app.use(express.errorHandler());
});

// routes
require('./apps/authentication/routes')(app);

app.listen(3000);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);

/apps/authentication/routes.coffee:

routes = (app) ->

    app.get '/login', (req, res) ->
        res.render "views/login",
            title: 'Login'
            stylesheet: 'login'

module.exports = routes

apps / authentication / views / login.jade template:

form(action='/sessions', method='post')
  label
    | Username
    input(type='text', name='user')
  label
    | Password
    input(type='password', name='password')
  input(type='submit', name='Submit')

nothing unusual, I got the stylesheet file and login.css in the public /stylesheet/login.css instead of the login template from the authentication /routes.coffe when viewing http: // localhost: 3000 /

Cannot GET /

there is no other error message from node:

Express server listening on port 3000 in development mode

I can’t understand where the problem is, and it is really frustrating. Probably some kind of silly typo, but I can't figure it out :(

+3
2

, '/'. http://localhost:3000/login , '/login'. - :

app.get '/', (req, res) ->
  #if not logged-in then send to /login else
  res.render('/views/authenticated', 'Home', 'index')

. http://expressjs.com/guide.html#routing.

+2

, . , , GET /. , GET /login routes.coffee; , GET /anythinginyourpublicdir express.static.

+1
source

All Articles