-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
executable file
·59 lines (49 loc) · 1.56 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const express = require('express'),
routes = require('./src/routes'),
bodyParser = require('body-parser');
// Create our app
const app = express();
const PORT = process.env.PORT || 3000;
app.use(function (req, res, next){
if (req.headers['x-forwarded-proto'] === 'https') {
res.redirect('http://' + req.hostname + req.url);
} else {
next();
}
});
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.use(express.static('dist'));
app.use(routes);
app.listen(PORT, function () {
console.log('Express server is up on port ' + PORT);
});
// const nodemailer = require('nodemailer');
//
// // create reusable transporter object using the default SMTP transport
// let transporter = nodemailer.createTransport({
// service: 'gmail',
// auth: {
// user: 'spalahadvanced@gmail.com',
// pass: 'spalahadvanced1'
// }
// });
//
// // setup email data with unicode symbols
// let mailOptions = {
// from: '"Fred Foo 👻" <foo@blurdybloop.com>', // sender address
// to: 'tester@mailinator.com', // list of receivers
// subject: 'Hello ✔', // Subject line
// text: 'Hello world ?', // plain text body
// html: '<b>Hello world ?</b>' // html body
// };
//
// // send mail with defined transport object
// transporter.sendMail(mailOptions, (error, info) => {
// if (error) {
// return console.log(error);
// }
// console.log('Message %s sent: %s', info.messageId, info.response);
// });