mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-25 17:46:18 +00:00
Merge remote-tracking branch 'origin/feature/base-flow'
This commit is contained in:
commit
e757e5fdf9
5
.bowerrc
Normal file
5
.bowerrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"directory": "static/js/libs",
|
||||
"analytics": false,
|
||||
"timeout": 120000
|
||||
}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
node_modules
|
||||
test/workspace
|
||||
static/js/libs
|
||||
|
27
app.js
Normal file
27
app.js
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var http = require('http');
|
||||
var nodeStatic = require('node-static');
|
||||
var jade = require('jade');
|
||||
|
||||
var staticServer = new nodeStatic.Server('./static');
|
||||
var app = http.createServer(function(req, res, next) {
|
||||
// serve index for all app pages
|
||||
if (req.url.indexOf('/data.io.js') === -1) {
|
||||
if (req.url.indexOf('/js') === -1) {
|
||||
// Compile a function
|
||||
var index = jade.compileFile(__dirname + '/views/index.jade');
|
||||
res.write(index());
|
||||
res.end();
|
||||
} else {
|
||||
staticServer.serve(req, res);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var io = require('socket.io')(app);
|
||||
var data = require('data.io')(io);
|
||||
|
||||
require('./resources')(data);
|
||||
|
||||
app.listen(3000);
|
24
bower.json
Normal file
24
bower.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "nci",
|
||||
"version": "0.0.0",
|
||||
"homepage": "https://github.com/okv/nci",
|
||||
"authors": [],
|
||||
"dependencies": {
|
||||
"underscore": "1.8.2",
|
||||
"moment": "2.9.0",
|
||||
"react": "~0.13.1",
|
||||
"requirejs": "~2.1.17"
|
||||
},
|
||||
"moduleType": [
|
||||
"amd"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"app/components/",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
@ -26,11 +26,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/okv/nci",
|
||||
"dependencies": {
|
||||
"data.io": "^0.3.0",
|
||||
"jade": "^1.9.2",
|
||||
"node-static": "^0.7.6",
|
||||
"socket.io": "^1.3.5",
|
||||
"twostep": "0.4.1",
|
||||
"underscore": "1.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bower": "^1.4.1",
|
||||
"expect.js": "0.3.1",
|
||||
"mocha": "1.18.2"
|
||||
"gulp": "^3.8.11",
|
||||
"mocha": "1.18.2",
|
||||
"nodemon": "^1.3.7"
|
||||
}
|
||||
}
|
||||
|
20
resources/builds.js
Normal file
20
resources/builds.js
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function(data) {
|
||||
var builds = [{
|
||||
project: {
|
||||
name: 'foo'
|
||||
},
|
||||
start: Date.now(),
|
||||
step: 1,
|
||||
completed: false,
|
||||
status: 'inprogress'
|
||||
}];
|
||||
|
||||
var resource = data.resource('builds');
|
||||
|
||||
resource.use('readAll', function(req, res) {
|
||||
console.log('readAll');
|
||||
res.send(builds);
|
||||
});
|
||||
};
|
9
resources/index.js
Normal file
9
resources/index.js
Normal file
@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var _ = require('underscore');
|
||||
|
||||
module.exports = function(data) {
|
||||
_(['builds', 'projects']).each(function(resource) {
|
||||
require('./' + resource)(data);
|
||||
});
|
||||
};
|
7
resources/projects.js
Normal file
7
resources/projects.js
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function(data) {
|
||||
var projects = [{
|
||||
name: 'foo'
|
||||
}];
|
||||
};
|
20
static/index.html
Normal file
20
static/index.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/data.io.js"></script>
|
||||
<script src="/app.js"></script>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello world</h1>
|
||||
<div id="builds">
|
||||
|
||||
</div>
|
||||
|
||||
<button onclick="createMessage()">Add</button>
|
||||
</body>
|
||||
</html>
|
||||
|
5
static/js/app/app.js
Normal file
5
static/js/app/app.js
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
define(['react'], function(React) {
|
||||
console.log(React);
|
||||
});
|
8
static/js/main.js
Normal file
8
static/js/main.js
Normal file
@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require.config({
|
||||
baseUrl: '/js/',
|
||||
paths: {
|
||||
'react': 'libs/react/react-with-addons',
|
||||
}
|
||||
});
|
10
views/index.jade
Normal file
10
views/index.jade
Normal file
@ -0,0 +1,10 @@
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
title test
|
||||
script(data-main="/js/main" src="/js/libs/requirejs/require.js")
|
||||
script(type="text/javascript").
|
||||
require(['app/app']);
|
||||
|
||||
body
|
||||
h1 hello world
|
Loading…
Reference in New Issue
Block a user