Created
February 6, 2019 21:39
-
-
Save colinfwren/302a0fce6b81cfffb35d4b5613fee3c0 to your computer and use it in GitHub Desktop.
Example controller
This file contains hidden or 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
server.post('/test-runs', async (req, res, next) => { | |
try{ | |
console.log('Kicking off test run'); | |
exec('npm test', (error, stdout, stderr) => { | |
if (error) { | |
console.error(`Error running tests: ${error.message}`); | |
} | |
console.log(stdout); | |
console.error(stderr); | |
}); | |
res.send(200); | |
} catch (err) { | |
res.send(500, { error: err.message }); | |
} | |
next(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment