Single Page App on Google Apps Script
Install clasp command line tool (if you don't have it already)
npm install @google/clasp -g
Then login to your Google account:
Open terminal and clone this project.
You have to create an Apps Script project to run this code.
clasp create --type standalone --title "Apps Script Single Page App Example"
Now build the project and upload to your newly created Apps Script project
npm install npm run deploy
You don't have to upload the project everytime to see the changes. run:
npm run local
This will open a http://localhost:9090/ where you can view your development site.
In order to Mock the responses from your Google Apps Script API, update client/src/services/MockBackEnd.js
The client/src/pages contains the partial pages. See src/pages/routes.js where the routes are configured. You can customize the global styles in src/pages/scss. This project uses bootstrap as CSS framework.
The server/src folder contains the server side (Apps Script) code. You can use ES6 or npm modules in lib.js and any classes/files included in lib.js. api.js exposes the Apps Script API that the client side calls (see client/src/services/GASBackEnd.js)
How does it work?
Building the project
npm run build
will build the local development version. The output files are placed in deploy/local folder.
npm run prod
will build the 'production' version that is ready to be uploaded to Apps Script.
The author does not represent nor associated with Google in any way. This is project is only for learning purposes.