Attempt to clarify installation instructions a little
[vchess.git] / server / routes / messages.js
CommitLineData
298c42e6 1let router = require("express").Router();
866842c3 2const access = require("../utils/access");
1ad88021
BA
3const sendEmail = require("../utils/mailer");
4const params = require("../config/parameters");
298c42e6
BA
5
6// Send a message through contact form
866842c3 7router.post("/messages", access.ajax, (req,res) => {
603b8a8b 8 const from = req.body["email"];
99b7a14c
BA
9 // Replace potential newline characters in subject
10 const subject = req.body["subject"].replace(/\r?\n|\r/g, " ");
c5c47010 11 const body = req.body["content"];
603b8a8b 12
866842c3
BA
13 sendEmail(from, params.mail.contact, subject, body, err => {
14 res.json(err || {});
dac39588 15 });
298c42e6
BA
16});
17
18module.exports = router;