1
0
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:
Saad Jutt
2022-06-19 18:35:10 +05:00
parent dde293c852
commit b1a0fe7060
4 changed files with 13 additions and 10 deletions

View File

@@ -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 -->
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-) [![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#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

View File

@@ -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

View File

@@ -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 =

View File

@@ -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)