Populate participants reading a json file in hyperledger - javascript

i'm trying to create a transaction to automatically populate the participants of my network.
I have few experience with Javascript and Json, but my idea is to read an external json file to populate the participants.
Can someone show me how can i read the json file with javascript, in order to retrieve the informations?
Thanks

Related

How to upload and retrieve dict data from sever js

I have a simple project in which users fill a survey on a page, and I then have a js function that stores all of the data from the survey in a dictionary. I would now like to append this dictionary to a json file, and then upload this file to a server so that I can retrieve the data for further use on the website
I have heard that I should be using express with node but I'm new to web dev and I have no idea how

Open connection to MongoDB when page is loaded

new web developer here,
I am creating a test website where I can input data and add it to my MongoDB database.
I have a JavaScript file that manages the connection with my MongoDB database (app.js), and I have another JavaScript file that manages the elements within my webpage. (script.js)
I am trying to make it so when I load the page where I input data, I can call the method which connects the database, and I can use that allows me to push form data to my MongoDB database.
The only thing I am struggling with is how I would detect that the webpage is loaded and run the method that opens my database.
I am also struggling to understand how to pass my 'db' variable into my script.js file to allow me to get data from my webpage.
Any help is appreciated, I am using WebStorm to create my website.
EDIT: And links to resources that solve a similar issue to mine (basically sending data to MongoDB from a webpage), would be very helpful! I think I am also using nodejs for my app.js file

Download a PDF from MongoDB using jade

I'm using Node, along with express, Jade and a MongoDB. So far I'm able to query the database and display the data in a webpage.
In the database I am storing PDFs and I would like to be able to download these from the webpage. I can currently get the pdf data in the form of a string (of random character) and display them on a webpage but I'd like to have a button where the user can download it as a pdf.
To insert the pdf into the db I the below python code to open it and pyMongo to insert it.
file = Binary(open(filePath, "rb").read(), 0)
Thanks in advance.
This has little to do with the technologies you mention, but how you handle data on the client. Essentially you will need to utilise frontend JavaScript, HTML and how the browsers handle those in conjunction with data. A pointer would be here https://stackoverflow.com/a/39515978/3580261

create a digital archive with a database

I'm new to web development and I'm trying to create a website with a database that will store all the files in the archive with the ability to delete files and upload new ones to the database from my web page.
1)I used HTML, CSS, javascript to create the website
2)MySQL to create the database
and I also tried phpMyAdmin to create the database
but where will I go from there?
How will my website control and show the database?
According to your question, I assume that you don't have a backend for your website. You need to have a backend to access the database. You can use php as the backend to connect with the mySQL database.
PS: I can see that you have tagged the question with php. If you are using php and still you can't connect to the database, please share your code snippets.

Storing large but simple array in Javascript?

Im trying to solve a problem for restricting the display of certain shipping methods on a web store and a little stumped on the best way to accomplish.
I have a semi large (43000 row) csv file that consists of 2 columns. Zip Code and Day in transit. At the "estimate shipping" stage of checkout I need to query this data via javascript. Im taking the shipping address zip code and using it to look up its corresponding days in transit and return that value for some further calculations. Normally I would load this into a database table but this store is on BigCommerce where no direct DB access is available so Im assuming this has to get done client side without setting up a remote DB.
What would be the best way for me to store that information if it had to be client side? My original idea was to create a giant array and store it in a JS file on the server that would be included when needed. HTML localstorage? Any guidance is appreciated!
With localstorage you would get an 5mb per domain limit, I am not sure if that is enough to store the array you want.
Another way would be to convert that array to a .json file and use ajax/get in order to retreive it (GET will be cached so only the first time it will load the file from the server, then it will go much, much faster as it will load it from the client cache).

Categories