Skip to content

@souravdatta /jafoo.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
var cini = require('cinister');
var make_message = function (name, type) {
type = type.toUpperCase();
var html = name + ' is ' + type.toUpperCase();
if (type === 'GOOD') {
return '<h1>' + html + '</h1>';
}
else if (type === 'BAD') {
return '<h2>' + html + '</h2>';
}
else {
return '<h3>' + html + '</h3>';
}
};
var index_html = '<form method="GET" action="message">' +
' <input type="text" name="name" /> ' +
' <input type="hidden" name="type" value="good" /> ' +
' <input type="submit" />' +
'</form> ' +
'<form method="GET" action="message">' +
' <input type="text" name="name" /> ' +
' <input type="submit" />' +
' <input type="hidden" name="type" value="bad" /> ' +
'</form> ' +
'<form method="GET" action="message">' +
' <input type="text" name="name" /> ' +
' <input type="submit" />' +
' <input type="hidden" name="type" value="ugly" /> ' +
'</form> ';
cini.port(9000);
cini.get('/', function () { return index_html; });
cini.get('message', function (params) {
if (params.name && params.type) {
return make_message(params.name, params.type);
}
else {
return '<b>None found</b>';
}
});
cini.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.