I'm following Steven Senderson's posts about NodeJS. I have overcome the breaking code due to version change in Express as suggested in this question. Now when I am accessing my index.html page using localhost:13253 it is rendering contents of index.html as is. It is not rendering it using layout.html. I have traced it from ejs.js and ejs-middleware also the functions are called but layout is not being applied. The server code is as follows:
var express = require('express'),
app = express(),
api = require("./api/server.js"),
ejsm = require('ejs'),
ejsMiddleware = require('ejs-middleware');
app.use('/api', api);
app.use(ejsMiddleware(__dirname + '/Static', 'html', app));
app.use(express.static(__dirname + '/Static'));
app.listen(process.env.port || 12345);
EDIT:-
//INDEX.HTML
this is homepage
//layout.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Inventify (alpha)</title>
<script type="text/jscript" src="/scripts/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/scripts/knockout-2.2.0.js"></script>
<link rel="stylesheet" href="/Styles/app.css"/>
</head>
<body>
<h1 class="site-title">
<a href="/">Iventify<span class="version">(alpha)</span></a>
</h1>
<div class="main-container">
<%- body %>
</div>
</body>
<script type="text/javascript">
alert('from template');
</script>
</html>
Run the express binary to generate the bare express project (it does this!),
./node_modules/express/bin/express
and for the part that says
app.set('view_engine', 'jade');
Change that to ejs. It will now read all files with .ejs as ejs templates.