Skip to content
Myr

ejs parsing *.html for mvc example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 20c5892 · Browse files · 10 files+24 added−21 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+24 added−21 removed

  • other:+24 added−21 removed

10 files+24 added−21 removed

deleted:examples/mvc/views/app/index.ejs-5 removed
1<h1>Application Index</h1>2<p>Try visiting one of the following urls:</p>3<ul>4 <li><a href="/users">/users</a></li>5</ul>
added:examples/mvc/views/app/index.html+5 added
deleted:examples/mvc/views/user/index.ejs-6 removed
1<h1>Users</h1>2<ul>3 <% users.forEach(function(user){ %>4 <li><%- user.name %></li>5 <% }) %>6</ul>
added:examples/mvc/views/user/index.html+6 added
deleted:examples/mvc/views/user/show.ejs-1 removed
1<h1>Viewing user <%- user.name %></h1>
added:examples/mvc/views/user/show.html+1 added
deleted:examples/mvc/views/layout.ejs-8 removed
1<html>2 <head>3 <title>Express - MVC Example</title>4 </head>5 <body>6 <%- body %>7 </body>8</html>
added:examples/mvc/views/layout.html+8 added
modified:examples/mvc/app.js+3 added
5 unmodified lines
6var express = require('../../lib/express');78var app = express.createServer();910// Allow ejs templates to utilize ".html" extensions11app.register('.html', require('ejs'));1213require('./mvc').boot(app);1415app.listen();16console.log('Application server started on port 3000');
modified:examples/mvc/mvc.js+1 added-1 removed
64 unmodified lines
6566function controllerAction(name, plural, action, fn) {67 return function(req, res, next){68 var render = res.render,69 path = __dirname + '/views/' + name + '/' + action + '.ejs';69 path = __dirname + '/views/' + name + '/' + action + '.html';70 res.render = function(obj, options, fn){71 res.render = render;72 options = options || {};73 options.locals = options.locals || {};
11 unmodified lines