Datasets:

Modalities:
Text
Formats:
json
Languages:
code
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
Asankhaya Sharma
add py and js data
0414e50
raw
history blame
1.15 kB
const runCode = require('../lib/runCode')const bodyParser = require('body-parser')const express = require('express')const router = express.Router()router.use(bodyParser.json()) // for parsing routerlication/jsonrouter.use(bodyParser.urlencoded({ extended: true }))// GET handler for /router.get('/', (req, res) => { res.send('API requires POST to /code/<lang>')})// POST handler for /pyrouter.post('/py', async (req, res) => { const { filePath } = req.body const result = await runCode('py', filePath) // executes runCode() on specified .py and input files // BUG: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')// res.send(result)// FIXED: })// POST handler for /cpprouter.post('/cpp', async (req, res) => { const { filePath } = req.body const result = await runCode('cpp', filePath) // executes runCode() on specified .cpp and input files res.send(result)})// POST handler for /jsrouter.post('/js', async (req, res) => { const { filePath } = req.body const result = await runCode('js', filePath) // executes runCode() on specified .js and input files res.send(result)})module.exports = router