Fetching data from DynamoDB using node js - javascript

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.

Related

How to embed my Machine-learning R code in a website

I need to run my R-code through a website, with the user giving feature values from the website itself, which I have to use as new data for prediction in the R-code. How can I do it?
Have a form on the website which performs an HTML post to a REST api on your web server which will write the information to a database such as MySql, Postgres, MongoDB, or any other database of your choice. Then use a DBMS database management system (DBMS) such as MySQL Workbench, pgAdmin, or Robomongo to query the database and put the data into a csv file, and run your R-code on it. Then use the parameters from your machine-learning model on your server to serve content.
You can expose any R code as a REST API using packages such as plumber, OpenCPU or RestServ. Such an API can then be integrated into the website using Jacascript.

Automated static site client page creation with AWS Lambda

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.

How to allow users to access my Google API application without authenticating for it?

I've developed a small webapp, that pulls raw data from a Google Spreadsheet and builds it on a html, so my website users can see, filter and navigate through the data.
For that, I'm using Google Sheets API v4, but even going to an HTML, users are asked to "AUTHORIZE" access using their Google Accounts, before seeing the table/data.
Is there a way to display this table/data on the HTML, without requesting users to authorize through OAuth?
If you're dealing with accessing data and performing Google API calls, authorization is Google's way to protect and secure the user's data.
If you want to display the data without needing to undergo authorization, publish it to the web:
File -> Publish to the web. An embed code which contains a public url will be provided for you.
Here's a sample of my public data:
https://docs.google.com/spreadsheets/d/1mvFPT2Xx8bNEMUdPC9TDOexzNqVS399bxQATV3JVOyg/pubhtml?widget=true&amp

How to create new firebase db programmatically through API

I would like to create a separate firebase db for every client inside my firebase account. I don't want the client data to be a sub-branch of one single database. How do I achieve this without using the dashboard UI from firebase? I need to do it programmatically because there are many steps involved, e.g.:
Creation of an client administrator user
Creation of a predefined client database structure
Creation of a license for the client
Store information about the new client inside my license database (separate firebase db)
Creating separate backup script for every single client db
How do I set or get the secret of the new created database via API (programmatically)?
Any help is appreciated
As Kato answered on your related Github question:
There is no programmatic way to create a project. There is also a limit on the number of free projects you can create.
It is possible to create firebase projects, databases, apps using firebase tools.
Please refer to
firebase tools and documentation

Pre-loaded Local Database Backend for Javascript (Possible?)

I have recently seen articles on HTML5 and local Db creation and usage. I have also seen some examples of Javascript connection strings to existing Access Db backends. I am interested in finding a way to build a Db, pre-load it with records, and use a web app to connect and read the Db. For example, I have created many standalone applications with Tcl, in Windows, that read off of Sqlite Db files. Essentially, the application (.exe file) and Db file sit next to each other in a folder and function like any other Db application, except without the use of servers.
I would like to be able to do the same, but with a web app (.html) and Db file. Does anyone know if this is possible? As an example, I wanted to build a language application that runs in any browser, with pre-loaded words saved in the backend. So there would be two files, the web app, and the db file.
Any suggestions or links to resources would be really appreciated. The only thing close that I could come up with was connecting to Access via OLE through Javascript, however I need a Db that is multi-platform like Sqlite.
Thanks,
DFM
Your web app, its local database, and the "priming" data will all have to start somewhere, so I'll assume this all gets rolling during a live connection to a web server. When this first hit comes in, you:
Deliver the page and related code.
In your JavaScript, test for the existence of the database.
Exists? No priming necessary. Do nothing, or sync, etc.
Doesn't exist? Build it and deliver initial data. If this is slow, you can give the user a friendly warning: "Setting up, please stand by." Depending on how you're pushing down all that data, you might even show a progress bar: "Initializing database: 10%"...
There is no step 3.
Once setup is complete, this app could be entirely local -- no net connection required -- as long as you code it without the assumption of non-local resources.
References:
Getting Started with HTML5 Local Databases
Offline Web Applications in HTML5
You can access an already created sqlite db file through javascript. Look at the "Location of Database File" area of this link http://code.google.com/apis/gears/api_database.html
I know this is for Google Gears, but Gears uses SQLite and the location still applies without Gears and only using a sqlite db file.
For example, I used a firefox add-on 'SQLite Manager' to create a sqlite db file on my local machine. I then copied that file to C:\Users\\AppData\Local\Google\Chrome\User Data\Default\databases\file__0
I was able to access the file using JavaScript in Google Chrome:
var db = null;
try {
if (window.openDatabase) {
db = openDatabase("mydbfile.sqlite", "1.0", "HTML5 Database API example", 200000);
....
You have to be careful with the file name in Chrome as it automatically names each sqlite db by an id number. For example, I had to rename my sqlite db file name to 14 to get it to read from JavaScript in the browser. Once I did this, it worked like a champ and I was able to access all tables, data, etc.

Categories