I'm start experiment with nodejs/coffeescript and the jade engine.

I can see from the examples that setup are around seems pretty standard.

 app = express.createServer().listen process.env.PORT

    app.configure ->
        app.set 'views', __dirname + '/views'
        app.set 'view engine', 'jade'
        app.set 'view options', layout: true
        app.use express.bodyParser()
        app.use express.static(__dirname + '/public')
        app.use app.router

    app.get '/ekmHoliCal/index', (req, res) ->
        res.render 'index'

My structure of directory is as follows:

-- ekmHoliCal
  -- public
  -- views

The index file contains the line: This is the index file

layout.jade file:

!!! 5
        title Users
        script(type="text/javascript", src="http://code.jquery.com/jquery-1.6.4.js")
        script(type="text/javascript", src="/ekmholical/javascripts/client.js")
        div!= body 

When I navigate to /index I get served the index page as expected. However if I view source I see a link to jquery

<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.js">

and if I click on that link sure enough I see the source of the jquery file.

The index file also contains a link to my client.js :

<script type="text/javascript" src="/ekmholical/javascripts/simon.js"></script>

but when I click I get

Cannot GET /ekmholical/javascripts/client.js


I'm not really sur but isn't there a "public" directory or this is something usual in JNode.
Also, you may add Javascript tag instead of Java tag.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.