Added basic mail functionality and new npm start command in ./

This commit is contained in:
corner 2019-11-03 15:54:42 +01:00
parent d11238e19e
commit 25a32a234b
8 changed files with 3870 additions and 5 deletions

1288
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "concurrently \"ng serve\" \"nodemon ./server/bin/www\"",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
@ -28,10 +28,11 @@
"@angular/cli": "~8.3.14",
"@angular/compiler-cli": "~8.2.11",
"@angular/language-service": "~8.2.11",
"@types/node": "~8.9.4",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"concurrently": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
@ -39,6 +40,7 @@
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"nodemon": "^1.19.4",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",

View File

@ -6,6 +6,7 @@ var logger = require('morgan');
const cors = require('cors');
var indexRouter = require('./routes/index');
var mailRouter = require('./routes/mail');
var app = express();
@ -21,6 +22,7 @@ app.use(cors())
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter);
app.use('/mail', mailRouter);
// catch 404 and forward to error handler
app.use(function(req, res, next) {

View File

View File

@ -1 +1 @@
{"data":[false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,true,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false]}
{"data":[false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,true,false,false,false,false,true,false,false,false,false,false,false,true,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,false,false]}

2553
server/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,9 +11,11 @@
"express": "~4.16.1",
"http-errors": "~1.6.3",
"morgan": "~1.9.1",
"pug": "^2.0.4"
"pug": "^2.0.4",
"sendmail": "^1.6.1"
},
"devDependencies": {
"cors": "^2.8.5"
"cors": "^2.8.5",
"nodemon": "^1.19.4"
}
}

18
server/routes/mail.js Normal file
View File

@ -0,0 +1,18 @@
const express = require('express');
const sendmail = require('sendmail')({silent: true});
var router = express.Router();
router.post('/', (req, res, _next) => {
sendmail({
from: 'surpise-box@jobbel.nl',
to: req.body.email,
subject: 'test sendmail',
html: 'Mail of test sendmail',
}, function(err, reply) {
if (err) res.json({result: err});
else res.json({result: reply});
});
});
module.exports = router;