-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
34 lines (28 loc) · 857 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
const express = require('express');
const bodyParser = require('body-parser');
const fs = require('fs');
const fileUpload = require('express-fileupload');
const route = require('./routes/upload2')
const app = express();
<<<<<<< HEAD
let port = process.env.PORT || 4000,
=======
let port = process.env.PORT || 411,
>>>>>>> 2725002e96383fd25ba8a7ec5973a89a9660b76d
ip = process.env.IP || 'localhost';
var dir = '/tmp';
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
app.use(fileUpload({
useTempFiles: true,
tempFileDir: '/tmp'
}));
app.set("view engine", "ejs");
app.use(express.static("public"));
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use('/',route);
app.listen(port, ip, function(){
console.log('Server Online! Please goto: '+ip+":"+port);
})