GithubHelp home page GithubHelp logo

sasjs / minimal-seed-app Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 2.0 12.05 MB

Vanilla JavaScript seed app for SASjs

HTML 1.60% JavaScript 9.51% CSS 1.34% SAS 87.43% Dockerfile 0.12%
sas viya sasjs sasjs-seed-app sasjs-app

minimal-seed-app's Introduction

Vanilla JavaScript Seed App for SASjs

All Contributors

This is the minimal seed app for SASjs.

It runs on both SAS 9 and Viya. To deploy the services, execute the following:

/* define the app location, eg in metadata or Viya folders service */
%let apploc=/Public/app/minimal-seed-app;

/* include macros directly, else download & compile manually */
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;

/* create the two services */
filename ft15f001 temp;
parmcards4;
    proc sql;
    create table areas as select distinct area from sashelp.springs;
    %webout(OPEN)
    %webout(OBJ,areas)
    %webout(CLOSE)
;;;;
%mp_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)
;;;;
%mp_createwebservice(path=&apploc/services/common, name=getdata)

Next, open the src/index.html file and update the appLoc in the initSasJs() function to the same folder location used above. Deploy to the SAS Web Server is recommended using the deploy NPM script provided in the package.json file.

It deploys the app to a specified server via SSH using the rsync command. Note - this is not available by default on Windows. A guide for installing it is available here.

To be able to run the deploy script, two environment variables need to be set:

SSH_ACCOUNT - your SSH account, this is of the form [email protected] DEPLOY_PATH - the path on the server where the app will be deployed to, typically /var/www/html/<some-subfolder>.

You can run the script like so:

[email protected]
DEPLOY_PATH=/var/www/html/$(whoami)/minimal
npm run deploy

You are done!

Local Development

You can put the frontend directly on the SAS Web Server, else you can also use node to spin up a local web server with CORS disabled. To install, submit npm install http-server -g. To execute, navigate to the location where the app is to be loaded and submit: npx http-server --cors

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Allan Bowe

๐Ÿ’ป โš ๏ธ ๐Ÿ‘€ ๐Ÿ“น ๐Ÿ“–

Yury Shkoda

๐Ÿ’ป โš ๏ธ ๐Ÿ“† ๐Ÿ“น ๐Ÿ“–

Krishna Acondy

๐Ÿ’ป โš ๏ธ ๐Ÿ‘€ ๐Ÿš‡ ๐Ÿ“ฆ ๐Ÿšง ๐Ÿ–‹

Muhammad Saad

๐Ÿ’ป โš ๏ธ ๐Ÿ‘€ ๐Ÿง‘โ€๐Ÿซ ๐Ÿ“–

Sabir Hassan

๐Ÿ’ป โš ๏ธ ๐Ÿ‘€ ๐Ÿค”

Mihajlo Medjedovic

๐Ÿ’ป โš ๏ธ ๐Ÿ‘€ ๐Ÿš‡

Vladislav Parhomchik

โš ๏ธ ๐Ÿ‘€

This project follows the all-contributors specification. Contributions of any kind welcome!

minimal-seed-app's People

Contributors

allanbowe avatar krishna-acondy avatar saadjutt01 avatar sabhas avatar semantic-release-bot avatar vladislavparhomchik avatar yuryshkoda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

minimal-seed-app's Issues

Provide random responses in mocked getdata (JS)

Currently our mocked getdata response is static: https://github.com/sasjs/minimal-seed-app/blob/main/sasjs/mocks/services/common/getdata.js

We should randomly provide 2 or 3 different responses.

Actual responses can be obtained by deploying the app to SASjs Server with 'sas' as the primary RUN_TIMES setting.

We should sanitise any environment specific outputs before committing to the repo, eg:

"SYSUSERID":"sasjsuser",
"MF_GETUSER":"SASjs User",
"SYSSITE":"0",
"SYSTCPIPHOSTNAME":"https://sasjs.com",
"SYSVLONG":"",
"SYSHOSTINFOLONG":""

enable auto authentication

currently when deploying as a streaming app, the first page is the logon screen

This makes no sense, as we have already authenticated (eg to access the /services/clickme file)

We should have a test on startup to see if we are already authenticated, and if so, to skip the logon screen.

Avoid in-line JavaScript

Currently the SASjs Config attributes are loaded in some inline-JS in the index.html

This will break for sites with secure CSP (Content-Security Policy) settings.

As best practice, our apps should work with strict CSP - so instead we should fetch the Config attributes from special HTML tags, eg:

    <my-app
      serverUrl=""
      appLoc="/apps/appName"
      serverType="SASJS"
      loginMechanism="Default"
      debug="false"
      useComputeApi="true"
      contextName="MyApp compute context"
    ></my-app>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.