mirror of
https://github.com/sasjs/server.git
synced 2026-04-10 07:33:13 +00:00
feat(studio): run selected code + open in studio
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import express from 'express'
|
||||
import { executeProgramRawValidation } from '../../utils'
|
||||
import { executeProgramRawValidation, runSASValidation } from '../../utils'
|
||||
import { STPController } from '../../controllers/'
|
||||
import { FileUploadController } from '../../controllers/internal'
|
||||
|
||||
@@ -24,6 +24,22 @@ stpRouter.get('/execute', async (req, res) => {
|
||||
}
|
||||
})
|
||||
|
||||
stpRouter.post('/run', async (req, res) => {
|
||||
const { error, value: body } = runSASValidation(req.body)
|
||||
if (error) return res.status(400).send(error.details[0].message)
|
||||
|
||||
try {
|
||||
const response = await controller.runSAS(req, body)
|
||||
res.send(response)
|
||||
} catch (err: any) {
|
||||
const statusCode = err.code
|
||||
|
||||
delete err.code
|
||||
|
||||
res.status(statusCode).send(err)
|
||||
}
|
||||
})
|
||||
|
||||
stpRouter.post(
|
||||
'/execute',
|
||||
fileUploadController.preuploadMiddleware,
|
||||
|
||||
Reference in New Issue
Block a user