mondora/mondora-website-back

View on GitHub
server/routes/courtesyForm.js

Summary

Maintainability
A
0 mins
Test Coverage
Router.map(function () {

    this.route("courtesyForm", {
        where: "server",
        action: function () {
            var emailAddress = this.request.body.email;
            var fullName = this.request.body.name;

            var body = "";
            body += "A person entered the courtesy contest!\n";
            body += "Name: " + fullName + "\n";
            body += "Email: " + emailAddress + "\n";
            var email = {
                from: "contest@mondora.com",
                to: "paolo.scanferla@mondora.com",
                subject: "Someone entered the courtesy contest!",
                text: body
            };
            Email.send(email);

            HouseFile.insert({
                name: fullName,
                email: emailAddress,
                origin: "courtesyContest"
            });

            this.response.writeHead(200);
            this.response.end();
        }
    });

});