Files: a8e5de96fd2a5b9ece705e921bdb70251a14d8c8 / index.js
915 bytesRaw
1 | var express = require('express'); |
2 | var nm = require('nodemailer'); |
3 | var bodyParser = require('body-parser'); |
4 | |
5 | var app = express(); |
6 | app.set('view engine', 'jade'); |
7 | app.set('views', './layouts'); |
8 | |
9 | app.use(bodyParser.json()); |
10 | app.use(bodyParser.urlencoded({extended: true})); |
11 | |
12 | app.post('/send', function (req, res) { |
13 | var name = req.body.nombre; |
14 | var email = req.body.elmail; |
15 | var website = req.body.siteurl; |
16 | var date = moment().format('MMMM D, YYYY'); |
17 | var str = name + " <" + email + "> " + website + " - " + date; |
18 | |
19 | var transporter = nm.createTransport(); |
20 | |
21 | transporter.sendMail({ |
22 | from: email, |
23 | to: 'gwen@gwenbell.com', |
24 | subject: 'New signup!', |
25 | text: str |
26 | }); |
27 | res.redirect('http://gwenbell.com/'); |
28 | }); |
29 | |
30 | app.use(express.static('./../books/build')) |
31 | app.use(express.static('/static/reserva')) |
32 | app.use(express.static('build')) |
33 | |
34 | app.listen(80); |
35 | console.log('Listening at http://localhost:80/'); |
36 |
Built with git-ssb-web