Add stdin

This commit is contained in:
Vrganj 2021-01-16 18:41:41 +01:00
parent 8fd831982e
commit c537cab2da
30 changed files with 42 additions and 32 deletions

View file

@ -39,6 +39,13 @@ app.post(
isArray: {
errorMessage: 'Supplied args is not an array',
},
},
stdin: {
in: 'body',
optional: true,
isString: {
errorMessage: 'Supplied stdin is not a string',
},
}
}),
async (req, res) => {
@ -49,7 +56,7 @@ app.post(
language.aliases.includes(req.body.language.toLowerCase())
);
const { stdout, stderr, output, ran } = await execute(language, req.body.source, req.body.args);
const { stdout, stderr, output, ran } = await execute(language, req.body.source, req.body.args, req.body.stdin);
res.status(200).json({
ran,