Automated static site client page creation with AWS Lambda - javascript

I am looking to build some automated HTML client pages from a template, such as mysite.com/clientpage. The generated page will contain their website url, company name and a portfolio of their products which feeds from a unique JSON file they send to our server. The client page template I use is built in Bootstrap 4 and uses Angular 1 to output the client products from their JSON feed. We just change some of the fields in the template and the page is then renamed with their company name. (eg. mysite.com/clientname.html)
I am struggling to come up with an infrastructure solution that will take their order event data and generate their unique site page, all automated. I have had ideas for generating these sites using SSH(Paramiko) in Lambda doing some SSH tasks on the template, hosting a template on GitHub and editing that every time and then deploying, hosting Wordpress pages etc.
There are a vast array of static site generators such as Hugo, GatsbyJS, Assembly but I am unsure how to tie them into event data for each client order.
The order event data comes in via API Gateway and AWS Lambda, what applications can I use to create these custom pages? How could I create custom client pages from event data?
FLOW
Customer orders page via website
Order JSON data passed to AWS Lambda via API Gateway
Unique customer page is created from a template adding in customers
website url, company name and the URL of their product feed into the
HTML page (This page generation part is the part I need automated,
depending on the details of the customer)

Assumptions:
The pages have to be static (put the data in a DB, and it seems like it would be pretty straight forward web application from there)
The Website is hosted on AWS and that is where the static pages should be created.
You will handle backing up these static pages in some way unrelated to this solution
You will either use a background process or a request process. It will have more reliable load on your environment if you setup a CRON job to handle the pages creation then if you respond to events. So I would recommend that without know more about your specific requirements.

You can use any templating engine like ejs and dump the output into s3.

Related

Fetching data from DynamoDB using node js

I have an application related to catalog of APIs, now I wanted to have a html page where it should display usage analytics like No of users registered with the application, No of API’s, etc.
i wanted to host this page on AWS and the data related to users and APIs will be stored in DynamoDB. I want to retrieve this information into my application using nodejs.
What should i do exactly to achieve this, any references would be helpful.

Does anyone run a service to POST data from client-side application?

I have a static JavaScript-only data visualisation. I want to collect the user's name and email before showing them the visualisation.
I have written a popup form to collect this info. But where can I store it? Do I have to add a whole back-end service and database just to store two variables?
I just need to POST two text strings, safely and reliably, from client-side JavaScript, and download the data as needed. Surely someone must offer a service that allows this? I would happily pay to avoid writing my own backend.
(I've looked at embedding a Mailchimp form, but it's too painful to style it in the way I need - I'd prefer to use my own front-end code.)
Have you looked at Campaign monitor ?
You can create a List that has the name + email then you can push this data to that list using AJAX:
https://www.campaignmonitor.com/appstore/ajax-subscription-form/
AWS Mobile Hub (DynamoDB, Lambda, API Gateway, Cognito)
-Integrated console that helps you create, build, test, and monitor your mobile apps that leverage AWS services
Parse server
-Open source server released by Parse/Facebook to replicate functionality of Parse
remoteStorage
-Everything in one place – your place. Use a storage account with a provider you trust, or set up your own storage server. Move house whenever you want. It's your data.

What is good way to render scorm 1.2 package in a web page?

We have some scorm 1.2 content hosted in our server and would like to integrate in our website. I didn’t find any good article that explains how to do it right way. I found lot of articles/tutorials explaining various apis and events about Scorm 1.2, Scorm 2004 and TinCan but none about integrating content in a html page.
Are there any good javascript libraries (scorm players?) that actually reads imsmanifest.xml file and render content?
There are a lot of questions like this on StackOverflow. And the web in general.
Server side Recipe:
Serverside script to allow the upload of a zip or FTP/SFTP, scp etc...
Serverside script to Unzip a Zip file (optional)
Serverside script to parse the imsmanifest.xml (one to many content objects)
SQL or NOSQL DB to store data (optional)
You need to control any launch data, and parameters as well as thresholds defined in the imsmanifest.xml required to launch the content.
Client Side Recipe:
You probably will want a UI for login/user management and assignments
Shareable Content objects commonly run within IFRAMEs, popup windows, new tabs or windows. Determine how you want to launch them.
You'll need a JavaScript SCORM Runtime exposed "API" for 1.2. You'll need to read up on the CMI Object and its namespaces/rules. Don't worry, most the specification is optional.
You'll need to use AJAX to submit the student attempt when they call commit. You'll want to control this with a 'sync' call in cases where the student has closed their browser, or was navigated away from your site. Else, you'll lose their data.
You could get away with localStorage vs the server side storage of data depending on your goals.
General flow for your site is to wait for the student to choose an assignment. Load their CMI Object (clean/new or suspended/resumed). Then load the SCO, wait for them to make calls against your JavaScript API.
Be very careful about not round tripping your back end on get and set value requests. Use the commit to do that so your not spamming your backend.

How can I authenticate Shopify API from within my store's theme?

I want to access the admin/products.json and admin/metafields.json within my theme's javascript, so that I can display certain data outside of the product's page. Is it possible to do this within my theme files, or is it required that I create an external API application?
https://docs.shopify.com/api/product
https://docs.shopify.com/api/metafield
(example URL: https://apikey:password#hostname/admin/resource.json)
I have created a "Private App" API Key/Password through Shopify dashboard. How can I authenticate a GET request within a javascript file that is part of my theme, so I can create variables from the data?
What I'm actually trying to accomplish is showing data (metafields) from certain products on a related product pages. All the info I need is in these 2 JSON files
Creating and external app seems a bit overkill for obtaining data within my shop, but if this is required, how should I go about this? I'm not an expert with APIs or creating apps and I've been reading everything to find a best course of action.
Thanks!
You don't need to make app to fetch data through API within store itself. Just do a ajax request having url "/admin/products.json" and it will return data.

What's the best way to handle function calls and data transfer between Servlet and HTML pages

I'm developing Web application using Servlet. Right now I'm able to display data retrieved from MySQL database and display it to HTML; even user logging in works and response is shown on HTML via Servlet.
Specifically in case of Withdrawal transaction of bank account, there is need of multiple call transfer and data handling between Servlet and HTML. I've tried using XML for data transfer, and it works for single call with static data. But I'm unable to optimize it for withdrawal process.
Can you please tell me better way of doing this?
to develop web application in servlets,its always better to use MVC pattern(architecture) which separates code into 3 different groups
1)Model - this part of the framework is to store the data of the application, such as databases, text data, files and/or other web resources.
2)View - this is the graphical user interface of the application. That would contain different buttons, text boxes and other controls to let the user interact with the application to complete his projects depending on sort of the software he is using.(jsps,html pages)
3)Controller - the actual back-end code constitutes the controller of the framework. A controller controls the data coming from the users, or going to the user from a model(servlet code)
advantage of MVC pattern are
1)code reuse
2)separating of concerns
3)less coupling between the layers

Categories