-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
25 lines (19 loc) · 702 Bytes
/
server.js
File metadata and controls
25 lines (19 loc) · 702 Bytes
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
var express = require('express');
var router = express.Router();
var bodyParser = require('body-parser');
var app = express();
var port = process.env.PORT || 8080;
var mailing = require('./mailing');
var cors_config = require('./cors_config');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
//Enable cors for every endpoint.
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", cors_config.origin);
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.use('/mailing',mailing);
app.listen(port);
module.exports = this;
console.log('Mailing up and running on port: ' + port);