diff --git a/.husky/precommit.sh b/.husky/precommit.sh index 996cf3e..9f3ba26 100644 --- a/.husky/precommit.sh +++ b/.husky/precommit.sh @@ -3,6 +3,7 @@ FILE="./client/wrangler.toml" if [ -f "$FILE" ]; then cp $FILE ~/tmp.wrangler.toml sed -i -e 's/account_id = ".*"/account_id = "**********"/' $FILE + sed -i -e 's/pattern = ".*"/pattern = "**********"/' $FILE echo "$FILE updated" git add -A else diff --git a/README.md b/README.md new file mode 100644 index 0000000..1d47315 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Serverless Microapp + +## Client Hosted on Cloudflare Workers +- uses itty-router for Express-like routing +- uses handlebars for views engine +- 100,000 free requests per day + +## Server Hosted on AWS Lambda +- uses node engine +- best for database operations (i.e. working with MongoDB) diff --git a/client/README.md b/client/README.md index f220cf9..de00d80 100644 --- a/client/README.md +++ b/client/README.md @@ -20,6 +20,6 @@ Once you are ready, you can publish your code by running the following command: wrangler publish ``` -[wrangler config](https://developers.cloudflare.com/workers/wrangler/configuration/) -[handlebars](https://marnixkok.nl/news/blog/handlebars-templates-in-cloudflare-workers) -[serverless rendering](https://blog.cloudflare.com/serverless-rendering-with-cloudflare-workers) \ No newline at end of file +- [wrangler config](https://developers.cloudflare.com/workers/wrangler/configuration/) +- [handlebars](https://marnixkok.nl/news/blog/handlebars-templates-in-cloudflare-workers) +- [serverless rendering](https://blog.cloudflare.com/serverless-rendering-with-cloudflare-workers) \ No newline at end of file diff --git a/client/assets/pages.js b/client/assets/pages.js new file mode 100644 index 0000000..4e9db74 --- /dev/null +++ b/client/assets/pages.js @@ -0,0 +1,24 @@ +import Handlebars from 'handlebars/runtime.js'; + var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; +templates['body'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { + var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined + }; + + return "\r\n
\r\n" + + ((stack1 = container.invokePartial(lookupProperty(partials,"structure/htmlhead"),depth0,{"name":"structure/htmlhead","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "\r\n\r\n Your name: " + + alias3(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === "function" ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":24,"column":44},"end":{"line":24,"column":52}}}) : helper))) + + "\r\n
\r\n\r\n" + + alias3((lookupProperty(helpers,"asyncTest")||(depth0 && lookupProperty(depth0,"asyncTest"))||alias2).call(alias1,{"name":"asyncTest","hash":{"name":"Vic Tester"},"data":data,"loc":{"start":{"line":27,"column":17},"end":{"line":27,"column":48}}})) + + "\r\n\r\n