-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
46 lines (39 loc) · 1.38 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
35
36
37
38
39
40
41
42
43
44
45
46
var express = require("express"),
app = express(),
bodyParser = require("body-parser"),
http = require("http"),
methodOverride = require("method-override"),
cors = require("cors"),
mongoose = require('mongoose'),
multer = require('multer'),
server = http.createServer(app),
jwt = require('jsonwebtoken'),
cloudinary = require('cloudinary'),
//morgan = require('morgan'),
path = require('path');
cloudinary.config({
cloud_name: "evileumas" ,
api_key:"842825948279461",
api_secret:"dGJAHsAqTEBpCPNEGjnzrTgV7NM"
});
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(methodOverride());
app.use('/',express.static(__dirname + '/desktop'));
app.use(cors());
app.use(multer({dest:'./temp/'}).single('tempImg'));
var port = 80;
var apiRouter = require('./api/routes')(app, express);
app.use('/api',apiRouter);
app.get('*', function(req, res){
res.sendFile('index.html',{root: __dirname + '/desktop/main/views/'});
});
//mongodb://localhost/cafeteria
mongoose.connect('mongodb://localhost/cafeteria', function(err, res) {
if(err) {
console.log('ERROR: connecting to Database. ' + err);
}
app.listen(port, function() {
console.log("Node server running on http://localhost");
});
});