Skip to content

Commit b4d020b

Browse files
committed
Setup intial server and database structure
1 parent f088184 commit b4d020b

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

server/app.js

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
1+
var express = require('express');
2+
var cors = require ('cors');
3+
var bodyParser = require('body-parser');
4+
var path = require('path');
15
var request = require('request');
2-
var host = 'localhost';
3-
var port = 7474;
4-
var urlForPosting = 'http://' + host + ':' + port + '/db/data/transaction/commit';
56

6-
var neo4j = require('neo4j');
7-
var db = new neo4j.GraphDatabase('http://localhost:7474');
7+
var app = express();
8+
var port = process.env.PORT || 3000;
9+
app.listen(port);
10+
11+
//Logger for dev environment
12+
if (process.env.NODE_ENV !== 'production') {
13+
var morgan = require('morgan');
14+
app.use(morgan('dev'));
15+
}
816

17+
//Middleware
18+
app.use(cors());
19+
//parse application/x-www-form-urlencoded
20+
app.use(bodyParser.urlencoded({extended: false}));
21+
//parse application/json
22+
app.use(bodyParser.json());
23+
//serve up static files in production
24+
//app.use('/', express.static(path.resolve(__dirname, '../build')));
25+
app.use(express.static(__dirname + '/../client'));
926

10-
var node = db.createNode({hello: 'world'});
11-
node.save((err,node) => {
12-
if (err) {
13-
console.log('Error saving new node to database: ', err);
14-
} else {
15-
console.log('Node saved to database with id: ', node.id);
16-
}
17-
})
27+
//Neo4j setup
28+
var neo4j = require('neo4j');
29+
var db = new neo4j.GraphDatabase('http://localhost:7474');

0 commit comments

Comments
 (0)