1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 11:24:35 +00:00

fix: change api endpoint SASjsExecutor/do -> SASjsApi/stp/execute

This commit is contained in:
2021-11-02 09:54:56 +00:00
parent d52c2ed18c
commit d93673f2a5
3 changed files with 28 additions and 28 deletions

View File

@@ -8,6 +8,33 @@ const stpRouter = express.Router()
const fileUploadController = new FileUploadController()
stpRouter.get('/execute', async (req, res) => {
if (isExecutionQuery(req.query)) {
let sasCodePath =
path
.join(getTmpFilesFolderPath(), req.query._program)
.replace(new RegExp('/', 'g'), path.sep) + '.sas'
await new ExecutionController()
.execute(sasCodePath, undefined, undefined, { ...req.query })
.then((result: {}) => {
res.status(200).send(result)
})
.catch((err: {} | string) => {
res.status(400).send({
status: 'failure',
message: 'Job execution failed.',
...(typeof err === 'object' ? err : { details: err })
})
})
} else {
res.status(400).send({
status: 'failure',
message: `Please provide the location of SAS code`
})
}
})
stpRouter.post(
'/execute',
fileUploadController.preuploadMiddleware,

View File

@@ -10,31 +10,4 @@ webRouter.get('/', async (_, res) => {
res.sendFile(path.join(getWebBuildFolderPath(), 'index.html'))
})
webRouter.get('/SASjsExecutor/do', async (req, res) => {
if (isExecutionQuery(req.query)) {
let sasCodePath =
path
.join(getTmpFilesFolderPath(), req.query._program)
.replace(new RegExp('/', 'g'), path.sep) + '.sas'
await new ExecutionController()
.execute(sasCodePath, undefined, undefined, { ...req.query })
.then((result: {}) => {
res.status(200).send(result)
})
.catch((err: {} | string) => {
res.status(400).send({
status: 'failure',
message: 'Job execution failed.',
...(typeof err === 'object' ? err : { details: err })
})
})
} else {
res.status(400).send({
status: 'failure',
message: `Please provide the location of SAS code`
})
}
})
export default webRouter

View File

@@ -64,7 +64,7 @@ const Main = (props: any) => {
setEditMode(false)
} else {
window.open(
`${baseUrl}/SASjsExecutor/do?_program=${props.selectedFilePath.replace(
`${baseUrl}/SASjsApi/stp/execute?_program=${props.selectedFilePath.replace(
/.sas$/,
''
)}`