-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
37 lines (29 loc) · 985 Bytes
/
app.js
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
const express = require("express");
const mongoose = require("mongoose");
// uncomment after placing your favicon in /public
// const favicon = require("serve-favicon");
const path = require("path");
const app = express();
const server = require("http").createServer(app);
//image data
app.use(express.static("data"));
// configure router, socket
require("./config/socket")( server );
require("./config/routes")( app );
//require("./config/timer").imageTimer(app);
// configure mongoose
// setup default mongoose module
const mongoDB = "mongodb://127.0.0.1:27017/bigpicture";
mongoose.Promise = global.Promise;
// mongoose.set("debug", true);
/* mongoose.connect(mongoDB, {
useMongoClient: true,
}).then((db) => {
db.on("authenticated", () => {
console.log("authenticated to mongo");
});
db.on("error", console.error.bind(console, "MongoDB connection error:"));
}); */
mongoose.connect(mongoDB);
// const db = mongoose.connection;
module.exports = { app, server };