0

I have recently started the development of an App that was intended for the web, using Express.js + MongoDB to define a RESTFull Interface, all this is coupled with an HTML5 frontend that uses AJAX to receive and write data.

The first couple of beta-testers reported that they'd not be ok with the app being a web-application and would much rather have everything on their own computer for security reasons (personal data is handled).

Now, I know that there are a couple of ways to make a Node.js application appear like a native app see Packaging a node.js webapp as a normal desktop app [closed]. I already tried NW.js but I can't seem to find an option to actually run the express.js part of the application within the limits of NW.js.

To my questions:

  • Is there a way to run a restful api programmed with node & express within NW.js?
  • Is it possible to run MongoDB inside that container?
  • If both or either one are not true, is there a framework that supports running express & mongodb as a desktop application with my app?
Community
  • 1
  • 1
Sebastian van Wickern
  • 1,699
  • 3
  • 15
  • 31
  • Why would you need database for one user? Can't you use json files to store that data? Using express and database on client doesn't make much sense to me. Express is actually sort of something in between DB and client. If you are only on client you don't need that – Molda Dec 02 '15 at 17:04
  • That kinda depends on the use-case. I'd prefer a database, because of the amount of data that is handled. And as I said, it's a port, the original software was written with express, because it was planned as a web-service. And this community gets more hostile by the day. People not reading and understanding the question and down voting really piss me off. – Sebastian van Wickern Dec 02 '15 at 17:16
  • There are some client side databases, have a look at this stackoverflow.com/questions/4777968/i-need-a-client-side-browser-database-what-are-my-options – Molda Dec 02 '15 at 17:24
  • @Molda there are plenty of reasons one might prefer a local database. I've had good experiences using [electron](http://electron.atom.io/) and [LevelDB](http://leveldb.org/). You wouldn't be using Express, but depending on how you've already built the application it may be trivial to write a connector class as a drop-in replacement for routing. Edit: As you're already using MongoDB, LevelDB may be an attractive embedded option because it has an impressive collection of modules, such as [LinvoDB](https://github.com/Ivshti/linvodb3), which supports MongoDB-style queries. – Fissure King Dec 02 '15 at 21:50
  • Just let me tell you is not a easy task, But you can do it with Electron, this app permit to you to create a .exe file, where you can start your express server, so you app,,, the main problem is when you gonna install this in a desktop because after that have to install node and mongo. – SAMUEL OSPINA Aug 19 '16 at 04:17

1 Answers1

2

I would focus the effort you would put into porting your app into making those same customers feel comfortable with your security measures for protection their data in the existing web-application format.

But if you really want them to run it locally then they probably need their own Mongo installed. Instead of a full blown mongo install I found NeDB. It implements the same Mongo api's so you should be able to port easily.

https://github.com/louischatriot/nedb

Embedded persistent or in memory database for Node.js, nw.js, Electron and browsers, 100% Javascript, no binary dependency.

greg_diesel
  • 2,955
  • 1
  • 15
  • 24