• R/O
  • HTTP
  • SSH
  • HTTPS

zephyr: Commit

This repository is for zephyr, which is implemented for a GUI of Eos.


Commit MetaInfo

Revision4cb18ebf405c9f270ab8ca6a76efd9345c583cc3 (tree)
Time2016-01-27 02:14:33
Authorhimetani_cafe <fumifumi@yasu...>
Commiterhimetani_cafe

Log Message

[TMP] Initialize db for debugging /api/v1/execution

workspace.debug/dca94750-c44f-11e5-88c4-f31cdfe97f4f is debugRest.mrc
register to db with
{
fileId: 'dca94750-c44f-11e5-88c4-f31cdfe97f4f',
name: 'debugRest.mrc',
parentId: '1f83f620-c1ed-11e5-9657-7942989daa00', //rootのuuid
fileType: 1 // file
}
use debugRes.mrc for executiong Eos command.

Change Summary

Incremental Difference

--- /dev/null
+++ b/server/api/v1/execution/index.js
@@ -0,0 +1,14 @@
1+'use strict';
2+
3+var express = require('express');
4+var router = express.Router()
5+var path = require('path')
6+var formidable = require('formidable')
7+var db = require(__dirname + '/../../../../server/class/DB').instance;
8+
9+router.post('/', function(req, res) {
10+ console.log(req.body);
11+ res.send(req.body);
12+});
13+
14+module.exports = router;
--- a/server/app.js
+++ b/server/app.js
@@ -18,7 +18,12 @@ DB.init()
1818 .then(function() {
1919 return DB.test2();
2020 })
21-.then(function(methods) {
21+.then(function() {
22+ if(process.env.NODE_ENV === 'debug') {
23+ return DB.testRest();
24+ }
25+})
26+.then(function() {
2227 var server = app.listen(config.port, config.ip, function () {
2328 console.log('Zephyr listening at http://%s:%s', config.ip, config.port);
2429 console.log(app.get('env'))
--- a/server/class/DB.js
+++ b/server/class/DB.js
@@ -30,7 +30,8 @@ var Files; // Model object of sequelize
3030 removeFile: removeFile,
3131 createDirectory: createDirectory,
3232 test1: test1,
33- test2: test2
33+ test2: test2,
34+ testRest: testRest
3435 /*
3536 removeDirectory: removeDirectory,
3637 getFilename: getFilename,
@@ -551,7 +552,7 @@ function test2() {
551552 fileId: uuid.v1(),
552553 name: 'one',
553554 parentId: '1f83f620-c1ed-11e5-9657-7942989daa00', // rootのuuid
554- fileType: 0
555+ fileType: 0 //directory
555556 };
556557 return Files.create(q1)
557558 .then(function() {
@@ -584,4 +585,14 @@ function test2() {
584585 });
585586 }
586587
588+function testRest() {
589+ var q = {
590+ fileId: 'dca94750-c44f-11e5-88c4-f31cdfe97f4f',
591+ name: 'debugRest.mrc',
592+ parentId: '1f83f620-c1ed-11e5-9657-7942989daa00', //rootのuuid
593+ fileType: 1 // file
594+ };
595+ return Files.create(q);
596+}
597+
587598 module.exports = { instance: instance };
--- /dev/null
+++ b/server/class/hoge.js
@@ -0,0 +1,6 @@
1+var options = {
2+ name: 'hogehoge',
3+ options: ['hoge']
4+};
5+
6+console.log(JSON.stringify(options));
--- a/server/express.js
+++ b/server/express.js
@@ -8,6 +8,7 @@ var express = require('express'),
88 module.exports = function(app) {
99 app.use('/workspace', express.static('./workspace/'));
1010 app.use(bodyParser.json());
11+ app.use(bodyParser.urlencoded());
1112
1213
1314 if(app.get('env') === 'development') {
--- a/server/routes.js
+++ b/server/routes.js
@@ -18,7 +18,7 @@ module.exports = function(app) {
1818 app.use('/api/dirCreation', require('./api/dirCreation'))
1919 */
2020 app.use('/api/v1/fileUpload', require(__dirname + '/api/v1/fileUpload'));
21-
21+ app.use('/api/v1/execution', require(__dirname + '/api/v1/execution'));
2222
2323 app.route('/*')
2424 .get(function(req, res) {
--- /dev/null
+++ b/test/rest/execution.test.js
@@ -0,0 +1,3 @@
1+'use strict';
2+
3+
Show on old repository browser