-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
48 lines (38 loc) · 1018 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const bodyParser = require('body-parser');
const cors = require('cors');
const express = require('express');
const telnet = require('./telnet');
const jobmine = require('./templates/jobmine');
const app = express();
const PORT = process.env.PORT || 8000;
app.use(bodyParser.json());
app.use(cors());
app.use(express.static('build'));
app.post('/api/hillaryclinton', (req, res) => {
// TODO
return res.json({"status": "todo"});
});
app.post('/api/jobmine', (req, res) => {
const {
mailFrom,
rcptTo,
name,
company,
jobTitle,
link,
} = req.body;
const body = jobmine(name, rcptTo, company, jobTitle, link);
telnet('ceca@uwaterloo.ca', req.body.rcptTo, body);
return res.json({"succes": true});
});
app.post('/api/nigerianprince', (req, res) => {
// TODO
return res.json({"status": "todo"});
});
app.post('/api/custom', (req, res) => {
// TODO
return res.json({"status": "todo"});
});
app.listen(PORT, () => {
console.log('Node app is running on port', PORT);
});