This React seed app provides a wrapper for @sasjs/adapter
, a lightning fast adapter for talking to SAS - on Viya, EBI, or SASjs Server.
If you are running on SAS 9 you need to set serverType
to SAS9 in sasContext.tsx
.
- clone the repo and change into the directory
- run
npm install
- run
npm run build
to create a production build in thebuild
folder. This can be deployed to the SAS web server here.
If you are running locally you will also need to whitelist localhost
on the server, or enable CORS in your browser as described here
The best way to deploy SAS services is using the SASjs CLI. Simply install, update the defaultTarget
attribute in the sasjsconfig.json file, and run the following commands:
sasjs auth
sasjs cbd
This will first authenticate to your target (follow the prompts) and after that you can just run sasjs cbd
to rebuild and deploy your services. If you set streamweb:true
in the sasjsconfig.json it will also deploy your frontend as a streaming app (no need for a web server).
If you are just looking to build quickly and don't have time to install NPM then you can also create the web services on ANY version of SAS by running the code below.
%let appLoc=/Public/app/react-seed-app; /* SAS Folders App Location */
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;
filename ft15f001 temp;
parmcards4;
proc sql;
create table areas as select distinct area from sashelp.springs;
%webout(OPEN)
%webout(OBJ,areas)
%webout(CLOSE)
;;;;
%mx_createwebservice(path=&appLoc/services/common, name=appinit)
parmcards4;
%webout(FETCH)
proc sql;
create table springs as select * from sashelp.springs
where area in (select area from areas);
%webout(OPEN)
%webout(OBJ,springs)
%webout(CLOSE)
;;;;
%mx_createwebservice(path=&appLoc/services/common, name=getdata)
This app will work on all versions of SAS Viya, in SAS 9 EBI from 9.3 and above, and on regular Foundation SAS (or WPS) installs using SASjs Server.
It will not work on SAS University edition.
This project uses Prettier to format code. Please install the 'Prettier - Code formatter' extension for VS Code.
Files you are editing will automatically be formatted on save.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!