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
--javascripts
client.js
-- views
index.jade
layout.jade
The index file contains the line: This is the index file
layout.jade file:
!!! 5
html(lang="en")
head
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")
body
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