Created
July 13, 2016 02:02
-
-
Save wallacyyy/56682f9b2a253a0f8b37e8756c22964b to your computer and use it in GitHub Desktop.
2016-07-11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const path = require('path') | |
const app = express() | |
const rsvp = require('./rsvp') | |
app.set('view engine', 'html') | |
app.use('/', express.static(path.resolve(__dirname, 'public'))) | |
app.get('/', function (req, res) { | |
res.sendFile(path.resolve(__dirname, 'index.html')) | |
}) | |
app.get('/confirm/:url', function (req, res) { | |
rsvp.confirm(req.params.url) | |
.then(function (updated) { | |
if (updated[0] > 0) { | |
return res.sendFile(path.resolve(__dirname, 'confirmed.html')) | |
} else { | |
return res.status(404).sendFile(path.resolve(__dirname, '404.html')) | |
} | |
}) | |
}) | |
const port = process.env.PORT || 3000 | |
app.listen(port, function () { | |
console.log('Listening on port 3000!') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment