Server side for json parsing


#1

Hi there!
i’m new to electron and npm.
I’m building an online/offline app that uses a sqlite database to store the informations (500k records per table).
For the rendering process i’m using datatables jquery plugin, which seems to need a “server side” process to speed up loading and rendering.
How can i simulate a server side process in electron?
I was looking for express server, socket.io and ipcMain/Renderer technique with no luck.

If the app works only online i will delegate the parsing “stuff” to a php/mysql script, but my app must work most the time offline and use the online state just for sync.

i’ve been looking either for rendering php code with nodes like uniter, but i think that the logic behind is not so clear to me.

Any kind of suggestion will be appreciated!


#2

Electron has Node built in, so it can handle server-side functions on its own and does not have to be online.


#3

thank you for the answer!
now i feel a little dumber asking you how can i make node handle and write server-side functions. :grinning:

i need to make my html page makes an AJAX call passing the data to a page (what kind of page? html? js?) that parses the data and retrieve me a JSON file/object.

i’ve tryied to call (using jquery) the js file that perform the query from the sqlite db, but it returns me the wole file, with function and so on…i don’t know how to handle it.


#4

As for learning how to do Node, I am going to refer you to Art of Node and the tutorials to which it refers. Since you’re working in Electron, both “client-side” and “server-side” reside on the same machine, so separation of interests isn’t particularly important. You can think of the main process as “server-side” with renderer processes as “client-side”, but all you really need is the main process (there’s an example of this in the Electron quick start).

Just a couple of functions. You just need to make a function that gets the data from the input fields, queries the database, and pushes the results to another function that writes them into the DOM.

i’ve tryied to call (using jquery) the js file that perform the query from the sqlite db, but it returns me the wole file, with function and so on…i don’t know how to handle it.

If you share your project (the relevant code at least, or even a whole git repo), someone here might be able to tell you what you’re doing wrong.


#5

actually i don’t know which one to post, because i’ve done a mess with the example i made. :grin:

do you think i can find any example/tutorial to help me get there?


#6

Yes, but I don’t know where you are right now, so all I can recommend are the two extremely general starting points in my previous post.

Why not start with the version where you try to call it and it dumps a bunch of code onto the HTML page? Do you know how to share code via GitHub?