mirror of
https://github.com/sasjs/server.git
synced 2026-01-14 09:20:06 +00:00
chore: code fixes
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
# SASjs Server
|
# SASjs Server
|
||||||
|
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||||
|
|
||||||
[](#contributors-)
|
[](#contributors-)
|
||||||
|
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||||
|
|
||||||
SASjs Server provides a NodeJS wrapper for calling the SAS binary executable. It can be installed on an actual SAS server, or locally on your desktop. It provides:
|
SASjs Server provides a NodeJS wrapper for calling the SAS binary executable. It can be installed on an actual SAS server, or locally on your desktop. It provides:
|
||||||
@@ -65,7 +68,7 @@ MODE=
|
|||||||
SAS_PATH=/path/to/sas/executable.exe
|
SAS_PATH=/path/to/sas/executable.exe
|
||||||
|
|
||||||
# Path to Node.js executable
|
# Path to Node.js executable
|
||||||
NODE_PATH=node
|
NODE_PATH=~/.nvm/versions/node/v16.14.0/bin/node
|
||||||
|
|
||||||
# Path to working directory
|
# Path to working directory
|
||||||
# This location is for SAS WORK, staged files, DRIVE, configuration etc
|
# This location is for SAS WORK, staged files, DRIVE, configuration etc
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ DB_CONNECT=mongodb+srv://<DB_USERNAME>:<DB_PASSWORD>@<CLUSTER>/<DB_NAME>?retryWr
|
|||||||
|
|
||||||
RUN_TIMES=[sas|js|sas,js|js,sas] default considered as sas,js
|
RUN_TIMES=[sas|js|sas,js|js,sas] default considered as sas,js
|
||||||
SAS_PATH=/opt/sas/sas9/SASHome/SASFoundation/9.4/sas
|
SAS_PATH=/opt/sas/sas9/SASHome/SASFoundation/9.4/sas
|
||||||
NODE_PATH=/Users/username/.nvm/versions/node/v16.14.0/bin/node
|
NODE_PATH=~/.nvm/versions/node/v16.14.0/bin/node
|
||||||
|
|
||||||
SASJS_ROOT=./sasjs_root
|
SASJS_ROOT=./sasjs_root
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
RunTimeType
|
RunTimeType
|
||||||
} from '../utils'
|
} from '../utils'
|
||||||
|
|
||||||
interface ExecuteSASCodePayload {
|
interface ExecuteCodePayload {
|
||||||
/**
|
/**
|
||||||
* Code of program
|
* Code of program
|
||||||
* @example "* Code HERE;"
|
* @example "* Code HERE;"
|
||||||
@@ -32,17 +32,17 @@ export class CodeController {
|
|||||||
* @summary Run SAS Code and returns log
|
* @summary Run SAS Code and returns log
|
||||||
*/
|
*/
|
||||||
@Post('/execute')
|
@Post('/execute')
|
||||||
public async executeSASCode(
|
public async executeCode(
|
||||||
@Request() request: express.Request,
|
@Request() request: express.Request,
|
||||||
@Body() body: ExecuteSASCodePayload
|
@Body() body: ExecuteCodePayload
|
||||||
): Promise<ExecuteReturnJsonResponse> {
|
): Promise<ExecuteReturnJsonResponse> {
|
||||||
return executeSASCode(request, body)
|
return executeCode(request, body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const executeSASCode = async (
|
const executeCode = async (
|
||||||
req: express.Request,
|
req: express.Request,
|
||||||
{ code, runTime }: ExecuteSASCodePayload
|
{ code, runTime }: ExecuteCodePayload
|
||||||
) => {
|
) => {
|
||||||
const { user } = req
|
const { user } = req
|
||||||
const userAutoExec =
|
const userAutoExec =
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ runRouter.post('/execute', async (req, res) => {
|
|||||||
if (error) return res.status(400).send(error.details[0].message)
|
if (error) return res.status(400).send(error.details[0].message)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await controller.executeSASCode(req, body)
|
const response = await controller.executeCode(req, body)
|
||||||
|
|
||||||
if (response instanceof Buffer) {
|
if (response instanceof Buffer) {
|
||||||
res.writeHead(200, (req as any).sasHeaders)
|
res.writeHead(200, (req as any).sasHeaders)
|
||||||
|
|||||||
Reference in New Issue
Block a user