-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev_server.js
53 lines (46 loc) · 1.23 KB
/
dev_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
'use strict';
var email = require('simplyemail');
var express = require('express');
const PORT = 3000;
var app = express();
app.get('/cijfer/:grade?', function (req, res) {
let num = parseFloat(req.params.grade);
if (Number.isNaN(num)) {
num = 9.2;
}
var grade = num.toString().replace('.', ',');
var passed = num >= 5.5;
email.cijfer({
className: 'Nederlands',
classUrl: 'https://app.simplyhomework.nl/class/YfDrLGoRfkRoqNe6E',
settingsUrl: 'https://app.simplyhomework.nl/settings',
grade: grade,
description: 'Literatuurmondeling',
passed: passed,
average: '8,5',
}).then(function (data) {
res.end(data);
});
});
app.get('/project', function (req, res) {
email.project({
projectName: 'Miljoenennota',
projectUrl: 'https://app.simplyhomework.nl/class/YfDrLGoRfkRoqNe6E',
settingsUrl: 'https://app.simplyhomework.nl/settings',
personName: 'Henk de Bakker',
}).then(function (data) {
res.end(data);
});
});
app.get('/html', function (req, res) {
email.html({
title: 'Test HTML email',
body: '<h2>simplySwag</h2>',
settingsUrl: 'https://app.simplyhomework.nl/settings',
}).then(function (data) {
res.end(data);
});
});
app.listen(PORT, function () {
console.log('Dev server running on port', PORT);
});