Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict'
- const express = require('express'),
- config = require('./config'),
- https = require('https'), //HTTPS
- app = express(),
- port = config.port,
- bodyParser = require('body-parser')
- //route mapping
- const login = require('./app/routes/login'),
- projects = require('./app/routes/projects'),
- timeSheet = require('./app/routes/timeSheet'),
- testMSPS = require('./app/routes/testMSPS')
- app.use((req, res, next) => {
- res.header("Access-Control-Allow-Origin", "*")
- res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS')
- res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
- next()
- })
- app.use(bodyParser.json());
- app.use(bodyParser.urlencoded({ extended: false }));
- // no need to verify login
- app.use('/login', login)
- app.use('/projects', projects)
- app.use('/testMSPS', testMSPS)
- //app.use('/timeSheet', timeSheet)
- // var server = https.createServer({
- // key: fs.readFileSync('privkey.pem', 'ascii')
- // , cert: fs.readFileSync('fullchain.pem', 'ascii') // a PEM containing the SERVER and ALL INTERMEDIATES
- // })
- // const server = https.createServer(options, app).listen(port, function () {
- // console.log(`...server is listening on port:${port}...`)
- // })
- app.listen(port, function () {
- console.log(`...server is listening on port:${port}...`)
- })
Advertisement
Add Comment
Please, Sign In to add comment