Skip to content

Instantly share code, notes, and snippets.

@kanwarujjaval
kanwarujjaval / form.ejs
Created February 23, 2014 13:54
Creating multiple forms with a single ejs file in node.js
<form action="<%= action %>" method="post">
<% if (fields.length) { %>
<% fields.forEach(function(field){ %>
<label><%= field.name %></label>
<input type="<%= field.type %>" name="<%= field.name %>" <% if (field.property) { %> <%= field.property %> <% } %> >
<% }) %>
<% } %>
<button type="submit"><%= title %></button> <!--Title for button is same as that of the page-->
// Use built in or binary modules
var crypto = require('crypto');
var hash = crypto.createHmac("sha1",key).update(signatureBase).digest("base64");