sasjs-server
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese@sasjs/server
@sasjs/server
SASjs Server is an open-source NodeJS wrapper for calling the SAS binary executable. It runs on a real SAS server or a local desktop and provides:
- A filesystem (SASjs Drive) for storing SAS programs and content
- Execution of Stored Programs from a URL (equivalent to SAS 9 Stored Processes / Viya Jobs)
- Web app streaming (serve frontend apps straight from SAS content)
- A REST API with Swagger docs
- Portability: apps built for SASjs Server deploy unchanged to SAS 9 / Viya via @sasjs/cli
SASjs Server 是一款用于调用SAS二进制可执行文件的开源NodeJS包装器。它可运行在真实SAS服务器或本地桌面环境中,提供以下功能:
- 文件系统(SASjs Drive):用于存储SAS程序及相关内容
- 从URL执行存储程序(等效于SAS 9存储过程 / Viya Jobs)
- Web应用流服务:直接从SAS内容中提供前端应用服务
- 带有Swagger文档的REST API
- 可移植性:为SASjs Server构建的应用可通过@sasjs/cli无修改部署至SAS 9 / Viya环境
Modes
运行模式
- Desktop mode (, default): single-user, no authentication, no database. CORS enabled by default.
MODE=desktop - Server mode (): multi-user with authentication, requires a database (
MODE=server,DB_CONNECT). CORS disabled by default — configureDB_TYPE=mongodb|cosmos_mongodbif enabling.WHITELIST
- 桌面模式(,默认):单用户模式,无需认证,无数据库。默认启用CORS。
MODE=desktop - 服务器模式():多用户模式,支持认证,需要数据库(
MODE=server,DB_CONNECT)。默认禁用CORS——若需启用,请配置DB_TYPE=mongodb|cosmos_mongodb。WHITELIST
Installation
安装
Download the relevant zip from GitHub releases and run the packaged executable (, etc.):
api-linuxbash
curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
unzip linux.zip && ./api-linuxOn first run it prompts (unless set as env vars) for the SAS executable path and the filesystem location for Stored Programs/temp files. Docker is also supported (, docker-compose files in the repo).
DockerfileApi从GitHub发布页面下载对应系统的压缩包,运行打包后的可执行文件(如等):
api-linuxbash
curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
unzip linux.zip && ./api-linux首次运行时(除非已通过环境变量设置),会提示输入SAS可执行文件路径以及存储程序/临时文件的文件系统位置。同时支持Docker部署(仓库中提供和docker-compose文件)。
DockerfileApiConfiguration via environment variables
通过环境变量配置
Set in , exported, prepended to the command, or in a file alongside the executable. Key variables:
/etc/environment.env| Variable | Purpose |
|---|---|
| |
| Path to |
| Comma-separated runtime priority, e.g. |
| Working directory: SAS WORK, staged files, drive, config |
| Location for files, sasjs packages, |
| |
| Extra SAS system options auto-applied to sessions (Windows vs Unix), e.g. |
| MongoDB connection string / type — required for server mode |
| LDAP auth: |
| Enable CORS and whitelist space-separated origins |
| Emulate |
可在中设置、通过export导出、在命令前添加,或在可执行文件旁的文件中配置。关键变量如下:
/etc/environment.env| 变量名 | 用途 |
|---|---|
| 运行模式: |
| |
| 逗号分隔的运行时优先级,例如 |
| 工作目录:包含SAS WORK、暂存文件、SASjs Drive、配置文件 |
| 文件、sasjs包、 |
| 协议: |
| 自动应用于会话的额外SAS系统选项(Windows与Unix系统有所不同),例如 |
| MongoDB连接字符串/类型——服务器模式下必填 |
| LDAP认证相关配置: |
| 启用CORS并配置空格分隔的源白名单 |
| 模拟 |
Developing against the API
基于API开发
- Server type for @sasjs/adapter / CLI targets is (
SASJS); auth is token-based.serverType: 'SASJS' - The REST API is self-documented via Swagger on the running instance.
- Server-side execution uses macros from @sasjs/core (e.g.
ms_*,ms_createfile) — services/jobs deployed by the CLI work as on other platforms.ms_adduser2group - Repo layout (for contributors): (Express/TypeScript backend: controllers, routes, middlewares, model),
api/(frontend),web/(REST examples),restClient/(server-mode DB seed).mongo-seed/
- @sasjs/adapter / CLI目标的服务器类型为(
SASJS);认证方式为基于令牌的认证。serverType: 'SASJS' - 运行实例上的Swagger文档可自动生成REST API的自描述内容。
- 服务器端执行使用@sasjs/core中的宏(例如
ms_*、ms_createfile)——CLI部署的服务/作业在其他平台上同样可用。ms_adduser2group - 仓库结构(面向贡献者):(Express/TypeScript后端:控制器、路由、中间件、模型)、
api/(前端)、web/(REST示例)、restClient/(服务器模式数据库种子数据)。mongo-seed/