mirror of
https://github.com/Hopiu/webapi-eca.git
synced 2026-03-16 22:10:31 +00:00
Demo preparations, getting towards a working example
This commit is contained in:
parent
2b4bfdc07e
commit
f60220c2b8
7 changed files with 27 additions and 26 deletions
|
|
@ -43,7 +43,8 @@ exports = module.exports = ( args ) =>
|
|||
config = require './config'
|
||||
config args
|
||||
@crypto_key = config.getCryptoKey()
|
||||
@db = redis.createClient config.getDBPort(), 'localhost', { connect_timeout: 2000 }
|
||||
@db = redis.createClient config.getDBPort(),
|
||||
'localhost', { connect_timeout: 2000 }
|
||||
@db.on "error", ( err ) ->
|
||||
err.addInfo = 'message from DB'
|
||||
log.error 'DB', err
|
||||
|
|
|
|||
|
|
@ -92,8 +92,7 @@ exports.handleEvent = ( req, resp ) =>
|
|||
resp.send 'Thank you for the event: ' + obj.event + ' (' + obj.eventid + ')!'
|
||||
db.pushEvent obj
|
||||
else
|
||||
resp.writeHead 400, { "Content-Type": "text/plain" }
|
||||
resp.send 'Your event was missing important parameters!'
|
||||
resp.send 400, 'Your event was missing important parameters!'
|
||||
|
||||
|
||||
###
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
###
|
||||
|
||||
Rules Server
|
||||
Server
|
||||
============
|
||||
|
||||
>This is the main module that is used to run the whole server:
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@ exports.myOwnEventFunction = function( callback ) {
|
|||
</script>
|
||||
|
||||
<script type = "text/template" id="templ_params">
|
||||
[
|
||||
{
|
||||
username: {
|
||||
description: "The username for the Web API"
|
||||
},
|
||||
password: {
|
||||
description: "The password for the Web API"
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
|
@ -55,8 +55,7 @@ exports.myOwnEventFunction = function( callback ) {
|
|||
Module name: <input type="text" id="input_id" />
|
||||
</p>
|
||||
<p>
|
||||
<textarea id="textarea_module" rows="20" cols="100">
|
||||
</textarea>
|
||||
<textarea id="textarea_module" rows="20" cols="100"> </textarea>
|
||||
</p>
|
||||
<p>
|
||||
Description of module:<br />
|
||||
|
|
|
|||
|
|
@ -9,16 +9,17 @@
|
|||
<div id="mainbody">
|
||||
<div id="pagetitle">Hi {{user.username}}, forge your own rules!</div>
|
||||
<p>
|
||||
<input type="radio" name="radio_event" id="radio_input" checked />
|
||||
<input type="text" id="input_event" /><br />
|
||||
<input type="radio" name="radio_event" id="radio_select" />
|
||||
<select id="select_event">
|
||||
</select>
|
||||
|
||||
<div id="div_left">
|
||||
<textarea id="textarea_module" rows="20" cols="100"> </textarea>
|
||||
<p>
|
||||
<button id="but_submit">save</button>
|
||||
</p>
|
||||
</div>
|
||||
<div id="div_right">
|
||||
<p><b>Available Event Modules:</b></p>
|
||||
<ul> </ul>
|
||||
</div>
|
||||
</p>
|
||||
<p>
|
||||
<button id="but_submit">save</button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
@ -49,7 +50,7 @@
|
|||
if(mthds) {
|
||||
var arr = mthds.split(',');
|
||||
for(var i = 0; i < arr.length; i++) {
|
||||
$('#select_event').append($('<option>').text(mod + '->' + arr[i]));
|
||||
$('#div_right ul').append($('<li>').text(mod + '->' + arr[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Rules Forge</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Rules Forge</h1>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -46,3 +46,12 @@ textarea {
|
|||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#div_left {
|
||||
float: left;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
#div_right li {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue