- based off of the apps-script-starter
- RealWorld Issue 434
- will follow the spec using GET and POST with a cors proxy
-
npm install
install dependencies -
copy
src\server\config.template.js
tosrc\server\config.js
- change the jwt encryption key and also give the id to the google script you're going to link it to
-
npx clasp login
Log in to Google clasp and authorize with your Google account. Open the link and authorize. -
Setup database and deploy location (options)
npx clasp create --type sheets --title "RealWorld Apps Script Project" --rootDir ./dist
Create a new Google Script bound to a Google Sheet (or set the type as standalone to create a standalone script in your Google Drive). Follow prompts in cmd to setup. May need to run this 2x and delete first document created after following the prompts.
- Linked scripts file will be located in .clasp.json
- Copy template
- Tools > Script Editor > copy the script id into from the url .claps.json
npm run deploy
npm run deploy:prod
Deploy the project (production mode)- faster development
npm run watch
can auto build webpack files for dev mode for faster development cyclenpm run upload
manually upload dist files
-
see ref
- proxy allows cors issues to be resolved while in browser
- also DELETE and PUT requests will be forced to POST requests
- besides content-type in POST request doesn't support headers, proxy will accept
Authorization: Token {{token}}
and will forward in post body
-
run simple server
cd proxy
php -S localhost:8000
- open
http://localhost:8000/
In the production mode, the function names and variable names are shrinked and the output code is auto-minifed. The production mode is not recommended for testing and debugging the Apps Script code.
The .claspignore
file allows you to specify file and directories that you do not wish to not upload to your Google Apps Script project via clasp push
.
The default .claspignore
file of the Apps Script Starter kit will push all the JS and HTML inside the rootDir
folder and ignore all the other files.