Google Apps Scripts (backend)
lastlink opened this issue · 3 comments
You can use the free tier of google apps scripts to fully power a jwt rest api using google sheets. You can also connect to a databasing using a JDBC connection. It provides POST and GET support. This example should use google sheets as a data storage
Google sheets size limits per https://support.google.com/drive/answer/37603?hl=en. You can only have 5 million cells per sheet (not per document). So if you had 2 columns you could have 2.5 million rows. There are no limits to writing and reading from google sheets using their direct api, external api calls do count against the limit. There is also a cache available.
It probably should be started off from https://github.com/labnol/apps-script-starter
The quota limits are here. https://developers.google.com/apps-script/guides/services/quotas
It would work fine on mobile, but b/c of cors will need to use a proxy such as php proxy or host a nodejs one through https://glitch.com/
If done right shouldn't need to use a google cloud api key
End goal
- using rest api with POST and GET methods from google scripts
- google sheet as a data store
- jwt authorization
- match realworld app spec
- cors with a php local proxy
- may have to do a format such as url?method=user to match spec with url?method= being the base url
- use free google scripts tier
Here's my source code WIP https://github.com/lastlink/realworld-apps-script/tree/restapi.
I went through all of the steps written in the readme file. when I tried to deploy it throw an error. please help me to figure out it.
D:\Appscript\realworld-apps-script-githubRepo\realworld-apps-script-master>npm run deploy
realworld-apps-script@0.0.3 deploy D:\Appscript\realworld-apps-script-githubRepo\realworld-apps-script-master
npm run build && npm run upload
realworld-apps-script@0.0.3 build D:\Appscript\realworld-apps-script-githubRepo\realworld-apps-script-master
webpack
Hash: 46e7353f68dc3a5e49af
Version: webpack 4.44.2
Time: 25029ms
Built at: 28/12/2020 3:24:48 pm
Asset Size Chunks Chunk Names
AES.js 13 KiB [emitted]
Cipher.js 1.41 KiB [emitted]
DES.js 20.9 KiB [emitted]
Rabbit.js 13.2 KiB [emitted]
TripleDES.js 20.9 KiB [emitted]
appsscript.json 505 bytes [emitted]
code-0.0.3.js 27.6 KiB 0 [emitted] main
Entrypoint main = code-0.0.3.js
[0] ./src/index.js 114 bytes {0} [built]
[1] (webpack)/buildin/global.js 472 bytes {0} [built]
[2] ./src/server/webapp.js 6.76 KiB {0} [built]
[3] ./src/server/mock.js 794 bytes {0} [built]
[4] ./src/server/config.js 146 bytes {0} [built]
[5] ./src/server/articles/index.js 2.1 KiB {0} [built] [1 error]
[6] ./src/server/utils.js 1.21 KiB {0} [built] [1 warning]
[7] ./src/server/auth/index.js 8.66 KiB {0} [built] [1 error]
WARNING in ./src/server/utils.js
Module Warning (from ./node_modules/eslint-loader/dist/cjs.js):
D:\Appscript\realworld-apps-script-githubRepo\realworld-apps-script-master\src\server\utils.js
23:20 warning Unexpected unnamed function func-names
26:22 warning Unexpected unnamed function func-names
41:24 warning Unexpected unnamed function func-names
✖ 3 problems (0 errors, 3 warnings)
@ ./src/server/articles/index.js 2:0-39 16:14-25
@ ./src/server/webapp.js
@ ./src/index.js
ERROR in ./src/server/articles/index.js
Module Error (from ./node_modules/eslint-loader/dist/cjs.js):
D:\Appscript\realworld-apps-script-githubRepo\realworld-apps-script-master\src\server\articles\index.js
1:20 error Unable to resolve path to module '../config' import/no-unresolved
1:20 error Missing file extension for "../config" import/extensions
✖ 2 problems (2 errors, 0 warnings)
@ ./src/server/webapp.js 2:0-40 63:17-31 78:15-29 105:15-29 112:15-29 119:15-29 127:15-29 135:15-29 141:15-29 179:17-31 183:17-31 198:15-29 204:15-29
@ ./src/index.js
ERROR in ./src/server/auth/index.js
Module Error (from ./node_modules/eslint-loader/dist/cjs.js):
D:\Appscript\realworld-apps-script-githubRepo\realworld-apps-script-master\src\server\auth\index.js
2:20 error Unable to resolve path to module '../config' import/no-unresolved
2:20 error Missing file extension for "../config" import/extensions
✖ 2 problems (2 errors, 0 warnings)
@ ./src/server/webapp.js 3:0-33 46:28-39 51:17-28 57:17-28 86:47-58 94:17-28 192:15-26
@ ./src/index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! realworld-apps-script@0.0.3 build: webpack
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the realworld-apps-script@0.0.3 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Hp\AppData\Roaming\npm-cache_logs\2020-12-28T09_54_49_121Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! realworld-apps-script@0.0.3 deploy: npm run build && npm run upload
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the realworld-apps-script@0.0.3 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Hp\AppData\Roaming\npm-cache_logs\2020-12-28T09_54_49_352Z-debug.log
Hello, we moved the addition of new implementations to this website : https://codebase.show/projects/realworld
Please submit your implementation there.
@nitingupta-123 I would need more details on what you did.
Generally you need to run npm install
, copy the config file, and run npx clasp login
before you can deploy. It seems like you just skipped these steps.