-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
32 lines (28 loc) · 969 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
var express = require('express')
var router = express.Router()
var mongoose = require('mongoose')
var cors = require('cors');
var prettyjson = require('prettyjson')
var blog = require('./blog')
var medReminder = require('./medReminder')
var eLearn = require('./eLearn')
// var wp = require('./wp')
require("dotenv").config({silent: true});
var DATABASE_URI = process.env.DATABASE_URI
var TOKENSECRET = process.env.SECRET
var app = express()
app.use(cors());
app.use('/blog', blog)
app.use('/med', medReminder)
app.use('/elearn', eLearn)
// app.use('/wp', wp)
mongoose.Promise = global.Promise;
mongoose.connect(process.env.DATABASE_URI || 'mongodb://<database name>').then(function() {
var PORT = process.env.PORT || 8080
app.listen(PORT)
console.log("Server is listening on ", PORT)
// var data = [{data: 1, name: 'JP'}, {data: 2, name: 'Ray'}]
// console.log(prettyjson.render(data))
}).catch(function(error) {
console.log("Server error: ", error)
})