forked from ZMcClung88/Union_Bindings
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
46 lines (33 loc) · 1.12 KB
/
index.js
File metadata and controls
46 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const express = require('express')
, bodyParser = require('body-parser')
, massive = require('massive')
, cors = require('cors')
, session = require('express-session')
, config = require('./backend/config');
var connString = 'postgres://postgres:@localhost/Union_Bindings';
// const app = module.exports = express();
var app = module.exports = express();
app.use(bodyParser.json());
app.use(express.static(__dirname + '/dist'));
app.use(cors());
var db = massive.connect({connectionString : connString},
function(err, localdb) {
db = localdb;
app.set('db', db);
}
)
// app.set('db', massiveInstance);
// var db = app.get('db');
// const massiveInstance = massive.connectSync({connectionString: config.database_secret});
const port = 8080; //80
// app.set('db', massiveInstance);
const productsControl = require('./backend/server/productsControl');
// PRODUCTS
app.get('/api/products', productsControl.getProducts);
//TEST////////////////////
app.get('/test', function(req, res) {
res.status(200).json('test working');
})
app.listen(port, () => {
console.log(`Ship docked on port ${port}`);
});