-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·39 lines (31 loc) · 1.13 KB
/
app.js
File metadata and controls
executable file
·39 lines (31 loc) · 1.13 KB
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
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
app.use(bodyParser.json()); // support json encoded bodies
app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
var email = require("./node_modules/emailjs/email");
var mailserver = email.server.connect({
user: "ashok@voereir.com",
password:"Blabil68",
host: "mailcluster.loopia.se",
ssl: true
});
app.use("/css", express.static(__dirname + '/website/css'));
app.use("/js", express.static(__dirname + '/website/js'));
app.use("/vendor", express.static(__dirname + '/website/vendor'));
app.use("/img", express.static(__dirname + '/website/img'));
app.get('/', function (req, res) {
res.sendfile('website/index.html');
});
app.post('/query', function (req, res) {
mailserver.send({
text: req.body.message,
from: req.body.email,
to: "Shivani <shivani@voereir.com>",
subject: req.body.subject
}, function(err, message) { console.log(err || message); });
res.sendStatus(200);
});
app.listen(80, function () {
//console.log('Example app listening on port 3000!');
});