diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..965c4a2 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,5 @@ +{ + "directory": "static/js/libs", + "analytics": false, + "timeout": 120000 +} diff --git a/.gitignore b/.gitignore index c9e0386..a188c9d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules test/workspace +static/js/libs diff --git a/app.js b/app.js index 18e49b8..4b3a917 100644 --- a/app.js +++ b/app.js @@ -2,14 +2,19 @@ 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('/builds') === 0) { - staticServer.serveFile('/index.html', 200, {}, req, res); - } else { - if (req.url.indexOf('/data.io.js') === -1) { + if (req.url.indexOf('/data.io.js') === -1) { + if (req.url.indexOf('/js') === -1) { + // Compile a function + console.log(1234); + var index = jade.compileFile(__dirname + '/views/index.jade'); + res.write(index()); + res.end(); + } else { staticServer.serve(req, res); } } diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..b697a95 --- /dev/null +++ b/bower.json @@ -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" + ] +} diff --git a/package.json b/package.json index e131729..efd8f8d 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "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", @@ -35,6 +36,7 @@ "devDependencies": { "bower": "^1.4.1", "expect.js": "0.3.1", + "gulp": "^3.8.11", "mocha": "1.18.2", "nodemon": "^1.3.7" } diff --git a/static/app.js b/static/app.js deleted file mode 100644 index 3f0203e..0000000 --- a/static/app.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var conn = data(io.connect()); -var builds = conn.resource('builds'); - -console.log(builds); - -builds.sync('readAll', function(err, result) { - console.log(result); -}); diff --git a/static/js/app/app.js b/static/js/app/app.js new file mode 100644 index 0000000..31d9354 --- /dev/null +++ b/static/js/app/app.js @@ -0,0 +1,5 @@ +'use strict'; + +define(['react'], function(React) { + console.log(React); +}); diff --git a/static/js/main.js b/static/js/main.js new file mode 100644 index 0000000..74d68ae --- /dev/null +++ b/static/js/main.js @@ -0,0 +1,8 @@ +'use strict'; + +require.config({ + baseUrl: '/js/', + paths: { + 'react': 'libs/react/react-with-addons', + } +}); diff --git a/views/index.jade b/views/index.jade new file mode 100644 index 0000000..7f4c9cc --- /dev/null +++ b/views/index.jade @@ -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