tracman-server/config/routes/test.js

35 lines
759 B
JavaScript
Raw Normal View History

2017-04-12 11:41:27 -06:00
'use strict';
const router = require('express').Router(),
mw = require('../middleware.js'),
mail = require('../mail.js');
router
2017-04-12 11:41:27 -06:00
.get('/mail', (req,res,next)=>{
mail.send({
to: `"Keith Irwin" <hypergeek14@gmail.com>`,
from: mail.from,
subject: 'Test email',
text: mail.text("Looks like everything's working! "),
html: mail.html("<p>Looks like everything's working! </p>")
2017-04-15 08:22:13 -06:00
})
.then(()=>{
console.log("Test email should have sent...");
res.sendStatus(200);
2017-04-15 08:22:13 -06:00
})
.catch((err)=>{
mw.throwErr(err,req);
2017-04-15 08:22:13 -06:00
res.sendStatus(500);
});
})
.get('/password', (req,res)=>{
res.render('password');
2017-04-15 08:22:13 -06:00
})
.post('/password', (req,res)=>{
//TODO: Server-side checks
res.sendStatus(200);
});
2017-04-12 11:41:27 -06:00
module.exports = router;