Skip to content

Commit

Permalink
chore: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan Bowe committed Jul 15, 2020
1 parent 0c2be37 commit b7a8955
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 47 deletions.
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

### Code Style

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.
61 changes: 14 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,24 @@

This seed app provides a wrapper for `@sasjs/adapter`, a lightning fast adapter for talking to both SAS 9 and Viya.

## Backend Services

For building anything other than a seed app, we recommend the `@sasjs/cli` tool for project configuration.

## Demo Services

Creating services in Viya can be done entirely in SAS Studio in three easy steps:

### Step 1 - load macros and obtain app token. Admin Task.

NOTE - YOU WILL NEED TO BE AN ADMIN TO RUN THIS BIT! As you are creating a new app token.
If you don't have internet access, you'll need to go to that link and copy / paste / run the macros manually.

```
filename mc url "https://raw.githubusercontent.com/macropeople/macrocore/master/mc_all.sas";
%inc mc;
%let client=new%sysfunc(ranuni(0),hex16.);
%let secret=MySecret;
%mv_getapptoken(client_id=&client,client_secret=&secret)
```
## Frontend Web

The log will contain a URL. Open this URL, click "open id" and paste the Authorization Code into the macro in step 2 below.
Clone the repo, `cd` into it, and `npm install`. Then update the following in `sas.service.ts`:

### Step 2 - obtain access token
* `appLoc` - the location in the metadata or viya folder tree where the backend services will be located.
* `serverType` - either SAS9 or SASVIYA.
* `serverUrl` - only relevant if not serving from the SAS domain (`!SASCONFIG/LevX/Web/WebServer/htdocs` in SAS9 or `/var/www/html` on SAS Viya)

The following code is used to obtain the access token:
If you are running locally you will either need to whitelist `localhost` on the server, or enable CORS as described [here](https://sasjs.io/frontend/cors)

```
%mv_getrefreshtoken(client_id=&client,client_secret=&secret,code=wKDZYTEPK6)
%mv_getaccesstoken(client_id=&client,client_secret=&secret)
```

### Step 3 - build some services!
## Backend Services

Services can be created programmagically using the code below.
Creating services in SAS 9 or Viya can be done entirely in SAS Studio using the code below.

```
%let appLoc=/Public/app/angular; /* Metadata or Viya root folder */
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc; /* download and compile macro core library */
filename ft15f001 temp;
parmcards4;
proc sql;
Expand All @@ -47,7 +28,7 @@ parmcards4;
%webout(OBJ,areas)
%webout(CLOSE)
;;;;
%mv_createwebservice(path=/Public/myapp/common, name=appInit, code=ft15f001,replace=YES)
%mp_createwebservice(path=&appLoc/common, name=appinit)
parmcards4;
%webout(FETCH)
proc sql;
Expand All @@ -57,25 +38,11 @@ parmcards4;
%webout(OBJ,springs)
%webout(CLOSE)
;;;;
%mv_createwebservice(path=/Public/myapp/common, name=getData, code=ft15f001,replace=YES)
%mp_createwebservice(path=&appLoc/common, name=getdata)
```

## Frontend Web

If you are running locally you will either need to whitelist `localhost` on the server, or enable CORS using one of the following commands:

| OS | Browser | Launch Command |
| :---: | :-----: | :-----------------------------------------------------------------------------------: |
| Mac | Chrome | `open -n -a Google\ Chrome --args --disable-web-security --user-data-dir=/tmp/chrome` |
| Linux | Chrome | `google-chrome --disable-web-security --user-data-dir="/tmp/chrome"` |

## Seedapp info
For building anything other than a seed app, we recommend the `@sasjs/cli` tool for project configuration.

This project was generated with Angular CLI version 9.0.3.

### Code Style

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.

0 comments on commit b7a8955

Please sign in to comment.