Skip to content

Commit

Permalink
simple jade
Browse files Browse the repository at this point in the history
  • Loading branch information
scc36 committed Oct 11, 2014
1 parent 4ba592d commit b8fe300
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
31 changes: 31 additions & 0 deletions exC-jadeExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Use NPM to install expressjs and jade
/* npm install express
* In case it breaks, choose an earlier version, like:
* npm install [email protected]
*
* npm install jade
*/

// Set express module to variable "express"
var express = require("express");

// Create an "app" variable from the express library
var app = express();

// Set the app engine to use Jade as the template engine
app.engine('jade', require('jade').__express);
app.set('view engine', 'jade')

// Set the template folder to be /public
// Should ideally be in dedicated template fold
app.set('views', __dirname + '/public');

// Add a "route" that leads to the req/res, as seen in Node.js
app.get("/", function(req, res){
res.render("simpleJade", { title: "Page Title", message: "Jade Example"});
});

// Starts up the server
var server = app.listen(1337, function() {

});
5 changes: 5 additions & 0 deletions public/simpleJade.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
html
head
title!= title
body
h1!= message

0 comments on commit b8fe300

Please sign in to comment.