Does manipulating MySQL data using React Native Application possible? - javascript

I'm about to create a React Native mobile application that can manipulate data to a remote MySQL database (cloud / not in mobile) without using PHP (back-end) at all. Is it possible or not?

it's not necessary you use a web service connecting to a database (but it is recommended).
In my case, I wrote a native module(Android https://facebook.github.io/react-native/docs/native-modules-android.html ) and then used JDBC to connect with a mysql server. Add this line to your gradle dependency (in case of android)
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.44'
and code in the same way as you do for a simple java jdbc program, you can connect to a database and perform operations on it. If you need further clarity please comment.

Related

Using MongoDB locally (electron)?

I need to store some data as part of my electron application. I know how to set up a REST API, and serve my application like so. However, is it also possible to use (e.g.) MongoDB locally, and implement something similar to a REST API locally? I would like to not assume an internet connection for this project.
If you need to implement a mongoDB like database locally for the application without internet, you can use lowdb
Yes it is possible, you have nodejs in electron so you can use mongoose:
https://github.com/Automattic/mongoose
But in this case every person who use your application have to install mongodb in his machine.

Synchronization between mysql and IndexedDB

I like to develop an Desktop App using nw.js (node-webkit) or Electron.
I am looking for a solution to sync between IndexedDB and MySQL Server + PHP(Laravel) on the cloud via Restful API.
PouchDB look good but that is out of option because it only support to sync with CouchDB.
What option do I have?
It's possible with dexie but not as complete as you get with pouchdb. The closest you come to a complete solution with dexie is using the Dexie.Syncable addon (https://github.com/dfahlander/Dexie.js/wiki/Dexie.Syncable.js) (not yet stable) and implement the backend from the following 2 backend sample implementations:
https://github.com/dfahlander/Dexie.js/tree/master/samples/remote-sync/
If you don't want to rely on Dexie.syncable, another solution would be to build your own sync addon based on the stable CRUD hooks that Dexie provides in it's default api:
https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27creating%27)
https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27updating%27)
https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27deleting%27)
Using those hooks, may log all local changes to a dedicated table for syncing with server when it goes online. This is what Dexie.Syncable is based on.

Parse REST API vs Parse JavaScript SDK

We are building a web & mobile chat application. The use case is that consumers can chat to our customer service using an android mobile app. Our backend team will reply to the users using the web app.
The web app will also have features to upload posts to the parse database that will be visible on the users newsfeed, query the parse database for items/transactions & upload new product SKUs to the database.
For the chat we will be using a service like Layer/Pubnub/Socket.IO along with Parse as the database. Will this architecture work well ?
Also, for the web app, should we use the native Parse JS SDK? or develop a Node.JS/Express.JS application using the Parse REST API?
For a server side Node.js app, I'd say the JS SDK works fine. I've used the REST API to develop JS Client-side plugins (there's prbly a JS way using RequireJS) and to interface Parse to other languages such as R. A couple of pastebins as samples:
Javascript - http://pastebin.com/eqAs5EDT
REST - http://pastebin.com/7TtZUwzy

Access MongoDB using Nodejs

I have an HTML 5 / Javscript application saves data in MongoDB using C# web services.
I believe we can access MongoDB using Node js . SO this is like accessing MongoDB using javscript.
How do I invoke the data-access script from the frontend, say on click of a button. Right now, this button click invokes a C# web service.
I can run the data-access script in the unix terminal after typing node and then the script name. But how do I bridge the gap between my frontend and backend; bring the two under one ecosystem ?
On click of a button, this script (that acsesses mongodb) needs to be invoked.
I think you can refer to javascript - Connecting MongoDB to the front-end? - Stack Overflow
Philipp has good explanation xD
Just to add a little bit on why you can't use your MongoDB (or DB) from frontend.
You'll need a driver to connect, and that's not included in your web browsers js engine.
Know more:
mongodb/node-mongodb-native
Node.js MongoDB Driver

Two-way communication between Meteor and Node

I am building a Node app that talks to an Xbee over serial and reads/controls several sensors/relays that are also Xbee equipped. I would like to use Meteor for the user interface and data storage with the Node app simply sending sensor updates and controlling the relays when triggered by the Meteor app. What would be the proper way to communicate between the Node and Meteor app? I know I can use a Node DDP client to insert sensor readings to the Meteor app. The part I am having problems with is sending commands from Meteor to the Node app to control the relays. I simply need to send a command that will execute certain code on the Node app to switch the relays. Maybe this is a simple question, but I'm not sure of the best way to accomplish this. Thanks in advance for any input.
You could just use Mongo as your point of integration. Each XBee device could just be a mongo document.
{
address: 'xbeeaddress',
relay1: 'on'
}

Categories

Resources