1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-11 08:20:04 +00:00

feat(api): set up endpoint for sas code execution

This commit is contained in:
Yury Shkoda
2021-06-10 20:12:23 +03:00
parent cb841ddcac
commit f6046b15ae
6 changed files with 84 additions and 9 deletions

23
src/routes/index.ts Normal file
View File

@@ -0,0 +1,23 @@
import express from 'express'
import { processSas } from '../controllers'
import { ExecutionResult, RequestQuery, isRequestQuery } from '../types'
const router = express.Router()
router.get('/', async (req, res) => {
const query = req.query
if (!isRequestQuery(query)) {
res.send('Welcome to @sasjs/server API')
return
}
const result: ExecutionResult = await processSas(query)
res.send(`<b>Executed!</b><br>
<p>Log is located:</p> ${result.logPath}<br>
<p>Log:</p> <textarea style="width: 100%; height: 100%">${result.log}</textarea>`)
})
export default router