Better board size auto-adjust. Still far from perfect
[vchess.git] / server / routes / messages.js
1 let router = require("express").Router();
2 const access = require("../utils/access");
3 const sendEmail = require("../utils/mailer");
4 const params = require("../config/parameters");
5
6 // Send a message through contact form
7 router.post("/messages", access.ajax, (req,res) => {
8 const from = req.body["email"];
9 // Replace potential newline characters in subject
10 const subject = req.body["subject"].replace(/\r?\n|\r/g, " ");
11 const body = req.body["content"];
12
13 sendEmail(from, params.mail.contact, subject, body, err => {
14 res.json(err || {});
15 });
16 });
17
18 module.exports = router;