-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
32 lines (25 loc) · 927 Bytes
/
server.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
"use strict";
// Allow ES6+ stuff from any files required from this file and beyond
require("babel-register")({
presets: ["react", "es2015", "stage-0"]
});
require("babel-polyfill");
const express = require("express");
const http = require("http");
const socketio = require("socket.io");
const mongoose = require("mongoose");
const chalk = require("chalk");
const app = express();
const server = http.createServer(app);
const io = socketio(server);
app.listen(3000, function() {
console.log(chalk.green("HTTP server listening on port " + this.address().port));
});
mongoose.connect("mongodb://localhost/mail", err => {
console.log(err ? chalk.red(err) : chalk.green("DB is ready."));
});
require("./lib/app/mailin");
require("./lib/app/sessions").default(app); // Must be above middleware
require("./lib/app/middleware").default(app);
require("./lib/app/routes").default(app);
require("./lib/app/socket").default(io);