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:
23
src/routes/index.ts
Normal file
23
src/routes/index.ts
Normal 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
|
||||
Reference in New Issue
Block a user