Where is the data stored in localhost? - node.js

i followed a tutorial and made a todo list web app using nodejs, express and ejs. after completing i used ngrok to make my localhost public so that i can share it with my friends, now i've realized that the tasks that i add on my todo list are saved in my server unless i restart it or close it completely. i want to know where the tasks which is a is stored in my local machine, does nodejs store it, or its saved in the memory of my local machine, more importantly if its already being stored somewhere why do i have to worry about using a database server like mongodb or firebase? hope my question is clear.

If you store your data in array or something in your code i can say "Yes. the data would be stored in the memory of your local machine".
And you don't have to worry about database if you don't have to permanently store your data.

Related

Access database from different network

I am trying to build a react-native application and to do so, I am following this tutorial : https://www.youtube.com/playlist?list=PLB97yPrFwo5hMR8znwt0NqgmmqzoPemnT
My application is like a form. People must enter some data into some fields and they will be sent into a database. People can later see their form from the application. So it is like simple a CRUD todo list application.
However, I do not want to use on-demand cloud computing platforms (AWS, GCP, OVH, ...) to store my data. I have my own server at home (NUC Intel) and want to use it as the application's server (store the data in there).
On my server I want to have a mongodb database and make it available from any computers that request it with the correct credentials. I would add firewalls as well for security.
This way, the react native application will be able to access read and write from this database wherever they are in the world as long as they have internet available.
As my backend I will use nodejs and express.
As my front end React Native and Redux.
Any ideas or tutorials I could follow ? I have been looking a lot but all the tutorials end by storing their database in GCP or AWS ... So is it possible to access mongodb database from a different network? Or would MySQL be a better solution?

How can I access my SQLite3 database on a live application?

So basically I have a SQLite3 Database that I am using for a Discord Bot. Is it possible for me to access my database file to check what's inside while the application is hosted and live?
I've considered that it is probably possible to do this from the command line within my terminal that I use to access the virtual host, but I do not know where to begin/what to input.
Ideally I would want to be able to view the file inside the DB Browser for SQLite program, for visual purposes, but for starters I want to know if its possible to see the live-updated database remotely, as my application is hosted on a virtual host/machine.
You can install phpliteadmin (https://www.phpliteadmin.org/) on your server to view your database.
Otherwise your can download your database file and view it in a client (Example of online client: https://extendsclass.com/sqlite-browser.html)

store string inside machine without using Database

I have created NodeJS application that communicate with SerialPort for example COM7.
because the COM name is not static it could be change all the time.
I'm looking for a way to save COM7 as a String inside a machine, and able to fetch it to NodeJS code.
and also change it remotly.
It is the same idea like database, but I see it really unnecessary to start database for only 1 record.
Look like Session on php but permanent.
** OS: Raspbian.
Thanks.

Saving images in node js to location with a link in a mongo database

I am working on a small project and I can upload data to a mongo database but so far I have been unable to save an image to the same database, a friend of mine advised me to send a reference to the database but at this stage I have not worked out how to do this, any assistance would be greatly appreciated.
You can use node-s3-uploader library from Turistforeningen or build something like that if you want to save on local disk. The work behind is get the image file which you received, transform it to multiple versions to optimize bandwidth, you keep a reference to original version on MongoDB or MySQL.
When client request an image, send them the original link, depend on which case they need, client will deduce original link to re-scale link.
Assets like image should not be saved to database system directly but to local disk of your server, and you just save the link of that image to the database.
The database system like mongodb or mysql should save things that will be queried, and that's why we use database system. Things like binary file or image should just save to the local disk, because the content of these file is unreadable, and also can not be queried. But the name, path or URL of these file can be queried, so we normally save these things to database system.

Query changes in specific document ids in CouchDb

I have a mobile app that stores data (fetched from a remote CouchDb instance) to a local SQLite database. Sometimes a sync request occurs, and I would like to know of all items in the local database whether their counterparts have changed on the server. (So, whether their revision is newer than the one in the local database.)
But how can I request only the specific items in the local database, without making hundreds of separate requests, and without fetching all the documents in the huge remote database?
The way I currently do it, is: for each local document, first get the HTTP header, and download the body only if the header shows a newer revision than the local doc has. I worry that for users that store a lot of items locally, this will result in a lot of HTTP request
What about using the Change Notification API?
Your app could request all recent changes, and then check if any of the local files has changed on the server.
Adding a filter might help getting only interesting changes.

Resources