-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
34 lines (31 loc) · 1.07 KB
/
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
const express = require('express');
const path = require('path');
const config = require('./config/config');
const knox = require('knox');
const fs = require('fs');
const os = require('os');
const formidable = require('formidable');
const gm = require('gm');
const mongoose =require('mongoose').connect(config.dburl, (err) => {
console.log(err);
});
var app = express();
app.set('views', path.join(__dirname, 'views'));
app.engine('html', require('hogan-express'));
app.set('view engine', 'html');
app.use(express.static(path.join(__dirname, 'public')));
app.set('port', process.env.PORT||3000);
app.set('host' + config.host);
let knoxClient = knox.createClient({
key: config.S3AccessKey,
secret: config.S3Secret,
bucket: config.S3Bucket
});
let http = require('http')
let server = http.createServer(app);
http.globalAgent.maxSockets = 1024;
let io = require('socket.io')(server);
require('./routes/routes')(express, app, formidable, fs, os, gm, knoxClient, mongoose, io);
server.listen(app.get('port'), () => {
console.log(`Photo grid running on ${app.get('port')}`);
});