Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

I have a basic node.js app that I am trying to get off the ground using the Express framework. I have a views folder where I have an index.html file. But I receive the following error when loading the web browser.

Error: Cannot find module 'html'

Below is my code.

var express = require('express'); 

var app = express.createServer(); app.use(express.staticProvider(__dirname + '/public'));

app.get('/', function(req, res) { 

res.render('index.html'); 

}); 

app.listen(8080, '127.0.0.1')

What am I missing here?

1 Answer

0 votes
by (106k points)

If you want to render basic HTML view you can have jade and include it in a plain HTML page:

include plain.html

The views/plain.html:-

<!DOCTYPE html>

And app.js can still just render jade-like as follows:-

res.render(index)

Related questions

0 votes
1 answer
0 votes
2 answers
0 votes
2 answers
0 votes
2 answers

Browse Categories

...