forked from alexsomeoddpilot/so-you-want-a-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (29 loc) · 832 Bytes
/
index.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
if (process.env.NODE_ENV === 'production') {
require('newrelic');
}
var express = require('express'),
serveStatic = require('serve-static'),
bodyParser = require('body-parser'),
mailer = require('./api/services/Mailer');
var portNum = process.env.PORT || 8080;
express()
.use(bodyParser.json())
.use(bodyParser.urlencoded({
extended: false
}))
.use(serveStatic(__dirname + '/assets'))
.post('/lead/create', function (req, res) {
mailer.mail({
from: 'Alex Robertson <[email protected]>',
to: 'Alex Robertson <[email protected]>',
subject: 'SYWAW',
text: 'So you want a website?'
}, function () {
res.json({
status: 'ok',
data: req.body
});
});
})
.listen(portNum);
console.log('Serving to http://localhost:' + portNum)