5

Trying to learn HTML5 and downloaded a test project https://github.com/amiklosi/Comicr. There is a folder named views with a index.jade which I suppose is the start page. What does it take to run that type of files? I can not open it directly in the browser.

Xtreme
  • 1,601
  • 7
  • 27
  • 59

2 Answers2

7

jade is a HTML templating engine. All jade files need to be transformed in the HTML.

You need to install to install jade by running

npm install jade

Also don't forget that you need to install other dependencie like express, nodemailer, etc (see requires in the source code).

Then run the app using

node app.js

And the application should by available on http://localhost/3000. All Jade templates will be correctly rendered and displayed as HTML.

kubetz
  • 8,485
  • 1
  • 22
  • 27
  • Ok, thanks! This is new to me;) Is there any special requirements for the web hosting to run it? Or can all web hosting run this? – Xtreme Jan 08 '12 at 16:03
  • @Xtreme If you want to deploy the application you need a hosting provider that is supporting node. [Here](https://github.com/joyent/node/wiki/Node-Hosting) is the list :). – kubetz Jan 08 '12 at 16:05
  • What is `npm`? My computer doesn't recognize it. – Hand-E-Food Oct 20 '16 at 23:54
  • 1
    @Hand-E-Food npm is a package manager. Installs, publishes and manages node programs. Install https://nodejs.org/en/ – Xtreme Oct 21 '16 at 18:19
2

You create a app.js file with the following contents.

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

app.configure(function(){
    app.set('views', __dirname + '/views');
    app.set('view engine', 'jade');
});

app.get('/', function(){
    res.render('index', {option: 'value'});
});
Fabián Heredia Montiel
  • 1,687
  • 1
  • 16
  • 30