4

I am developing a postman like application with some added features. For the frontend, I am using Angular 10, and for the backend, I am using node with fastify.js and for the database, I am using MongoDB via Atlassian MongoDB hosting.

Right now, I have set-up the electron app and using the same frontend code. It's working fine if I use the API(I have hosted my node server on ec2). I want to run this app without an internet connection. for that, I set up the node server in electron. The node server is working fine if I run it in the main electron process.

My electron application setup: I am running a node server in the electron app on port 5000. when electron app starts it will start the server.

To make sure everything is working fine I used a postman to access the node server running from the electron process. In postman, if I am hitting on http://localhost:5000/ while the electron app is running I am getting a response from the node server running in the electron. If I use localhost:5000 as the base URL and hit the API from frontend in electron it's working and I am getting a response. I checked the electron console network tab, Request is going to the http://localhost:5000/.

Now I want this app to run without the Internet. neDB is the most suggested DB for electron and it provides the same query syntax as MongoDB. Also, I found out library mongoose-nedb. Using that library I can use mongoose with neDB. So, If I use that library I don't need to change my node code and can use mongoose with neDB instead of MongoDB. So, I set-up my app with neDB and mongoose-neDB. for testing, I again use the postman as well as electron frontend. But now I am not getting any response.

I tried LinvoDB as well. same result.

Is this happening because I am using neDB outside the electron browser context? Can you suggest some solution so that I don't need to rewrite the node server in the electron app? Is this approach proper? any suggestion?

Ref:

I am using this boilerplate for the electron app: https://github.com/maximegris/angular-electron (I am putting my node code in root and importing it in main.ts)

mongoose-neDB: https://github.com/aerys/mongoose-nedb

neDB: https://github.com/louischatriot/nedb

LinvoDB: https://github.com/aerys/linvodb3

mongoose-LinvoDB: https://github.com/aerys/mongoose-linvodb3

Raj Thakar
  • 198
  • 9

0 Answers0