Last active
June 13, 2021 22:07
-
-
Save wadez/9815760613060015784d212e2da09bbd to your computer and use it in GitHub Desktop.
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 app = express() | |
const Pool = require('jpool'); | |
// middleare | |
app.use((req, res) => { | |
const pool = new Pool(); | |
req.job = (filename) => { | |
pool.add(path.resolve(__dirname, `jobs/${filename}.js`), req) | |
} | |
}) | |
// route | |
app.post('/email/change', function (req, res) { | |
req.job("sendEmail"); | |
res.send('email change requested') | |
}) | |
app.listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment