# @sasjs/adapter [![npm package][npm-image]][npm-url] [![Github Workflow][githubworkflow-image]][githubworkflow-url] [![npm](https://img.shields.io/npm/dt/@sasjs/adapter)]() ![GitHub License](https://img.shields.io/github/license/sasjs/adapter) ![GitHub top language](https://img.shields.io/github/languages/top/sasjs/adapter) ![GitHub issues](https://img.shields.io/github/issues/sasjs/adapter) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/sasjs/adapter) [npm-image]: https://img.shields.io/npm/v/@sasjs/adapter.svg [npm-url]: http://npmjs.org/package/@sasjs/adapter [githubworkflow-image]: https://github.com/sasjs/adapter/actions/workflows/build-unit-tests.yml/badge.svg [githubworkflow-url]: https://github.com/sasjs/adapter/blob/main/.github/workflows/build.yml [dependency-image]: https://david-dm.org/sasjs/adapter.svg SASjs is a open-source framework for building Web Apps on SAS® platforms. You can use as much or as little of it as you like. This repository contains the JS adapter, the part that handles the to/from SAS communication on the client side. There are 3 ways to install it: 1 - `npm install @sasjs/adapter` - for use in a nodeJS project (recommended) 2 - [Download](https://cdn.jsdelivr.net/npm/@sasjs/adapter@4/index.min.js) and use a copy of the latest JS file 3 - Reference directly from the CDN - in which case click [here](https://www.jsdelivr.com/package/npm/@sasjs/adapter?tab=collection) and select "SRI" to get the script tag with the integrity hash. If you are short on time and just need to build an app quickly, then check out [this video](https://vimeo.com/393161794) and the [react-seed-app](https://github.com/sasjs/react-seed-app) which provides some boilerplate. For more information on building web apps with SAS, check out [sasjs.io](https://sasjs.io) ## None of this makes sense. How do I build an app with it? Ok ok. Deploy this [example.html](https://raw.githubusercontent.com/sasjs/adapter/master/example.html) file to your web server, and update `servertype` to `SAS9`, `SASVIYA`, or `SASJS` depending on your backend. The backend part can be deployed as follows: ```sas %let appLoc=/Public/app/readme; /* Metadata or Viya Folder per SASjs config */ filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas"; %inc mc; /* compile macros (can also be downloaded & compiled seperately) */ filename ft15f001 temp; parmcards4; %webout(FETCH) /* receive all data as SAS datasets */ proc sql; create table areas as select make,mean(invoice) as avprice from sashelp.cars where type in (select type from work.fromjs) group by 1; %webout(OPEN) %webout(OBJ,areas) %webout(CLOSE) ;;;; %mx_createwebservice(path=&appLoc/common,name=getdata) ``` You now have a simple web app with a backend service! ## Detailed Overview The SASjs adapter is a JS library and a set of SAS Macros that handle the communication between the frontend app and backend SAS services. There are three parts to consider: 1. JS request / response 2. SAS inputs / outputs 3. Configuration ### JS Request / Response To install the library you can simply run `npm i @sasjs/adapter` or include a `