**I'm new to this field. I'm making a plugin that stores text data to chrome local storage using chrome.storage.local.set api. All I want is to Migrate that data from chrome local storage to MongoDB server. Is there any way to do it??..
You would need a server side for that.
What you can do is create a route in your server side that will save the data to the mongodb database and call it using the fetch api in your client's javascript.
I would recommend NodeJS and Express for that server side as it is coded in JS that you probably already know and the api is fairly simple.
Related
As the title states, I'm having trouble finding a way to send data from an electron.js app to a remote db/server.
I can use mysql to connect directly with a database but it doesn't strike me as a secure thing to do. I would like to send the data, probably a json string, to a php or js file on a server and handle the validation and database access there.
I'm very new to working with node.js and electron.js but I'm really excited over the possibilities of it.
Have you got a working web server?
I'd recommend express - it's fairly simple to get started. You could define a route that you could post your data to, and then that would in turn add it to the database.
You can make a standard AJAX request from the browserWindow of your Electron app. Please refer to this question:
javascript ajax request without framework
Since parse is now closing I have switched my database using MongoLab & Heroku using nodejs with Heroku.
Parse makes it easy to connect to your new Database in iOS using ParseUI to point my server ".herokuapp.com/parse".
The question I have is now I want to point to this server using javascript. How do I use parse to get its database at my ".herokuapp.com/parse" database using javascript?
Thanks
If you mean how to set the serverURL, it can be done in the javascript sdk like this:
Parse.initialize('appId');
Parse.serverURL = 'https://myappid.herokuapp.com/parse';
This is only required if you are using the javascript sdk in the browser however. In nodejs, parse-server exports an already initialized js sdk as the global variable Parse which can be used from everywhere.
I'm working on an HTML/JavaScript GUI application that will run on mobile devices (using Cordova) and also as a hosted web page that's accessible from a desktop web browser. I want to give the option to read and store data in a local offline database (SQL database most likely), as well as the option to connect to a web server and read/update data from the server as well.
If anyone has done something similar without having to write the data access routines twice (once for the server side, and once for the client offline storage side), I'd like to get some suggestions.
One solution I am thinking about (which has some unresolved issues still):
I could write the server in any platform (PHP, Java, Js, etc.), but don't want to replicate the data access code for the offline version, so am thinking to do the data access portion in JavaScript--maybe write a node.js server, and use sqlite for local/offline databases (which Cordova supports). I can't figure out how to provide similar local data functionality on a web browser.
The simplest option would be to run a server on the local machine, but I don't think that is easy in Cordova or on a desktop browser.
Check out PouchDB. PouchDB is compatible with CouchDB and is 100% Javascript. You can do some cool offline syncing to online syncing with CouchDB.
Check out https://cloudant.com/blog/pouchdb/ and http://pouchdb.com/faq.html.
I have a case where I would like to list all blobs in windows azure blob storage in a browser application where I dont want the user to submit their storage account credentials to the webserver. Wonder if its possible to use nodejs libraries for windows azure in the browser or I need to implement my own little javascript lib for doing the stuff I need in the browser.
I think you can take a look at Node.js SDK. It's for Node.js but I think could be used for browser with some code changes.
http://www.windowsazure.com/en-us/develop/nodejs/
If I understand correctly, one simple solution could be to create a Shared Access Signature on the blob container with List permission and then doing a List Blobs REST API call through AJAX. This will return you the list of blobs in XML format which you can parse and present it in the browser.
I am making a web-app using JavaScript. I plan to use Node.js to connect the app to an existing MySQL database.
First of all, will the Node code be written in the same .js file as my application? Or is it a separate file?
I need the data to be current at all times (even if you were to close the browser and re-open it, AND even in the event of the user not having a wifi connection), so my thought was to constantly update the local device's db and then to intermittently update the MySQL db. Is this the best strategy? If so, how exactly can Node talk to the offline db and MySQL?
First of all, will the Node code be written in the same .js file as my application? Or is it a separate file?
It is possible to keep your client side JavaScript in the same file as your server side JavaScript, but it doesn't make any sense to do so. They are separate programs. (Library files, on the other hand, are a different story).
so my thought was to constantly update the local device's db and then to intermittently update the MySQL db.
Working with a local database and syncing to a shared one is a common strategy. You do need to handle conflicting updates in a way that is sensible for your purposes though.
If so, how exactly can Node talk to the offline db and MySQL?
Node.js can't talk to the offline database, at least not directly.
You will have a web application running in the browser. It will use client side JavaScript with a client side database and some means of communicating with the server (often this is done by sending JSON over HTTP to and from a web service).
Then you will have a server side application running in Node.js. It will use server side JavaScript with a server side MySQL database and some means of communicating with the client (i.e. an HTTP server hosting a web service).