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.
Related
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.
I was wondering what the best way is to save config values in nodejs/express which are subject to change. I'm not talking about database credentials that you store inside your environment variables. But say a game where the config values are changeable within the admin panel. A config for example could be how often in ms a player receives a random reward. I could store this directly into the code (but I'd have to alter my code everytime I would like to change this and this cant be changed from within an admin panel), have some different file that has an object with these configs or save it into a mysql database (I would need to query the db everytime I need a config though).
I'm not really sure what the best way is to do this. Basically I want a way to store flexible configs within my nodejs application that are subject to change.
Thanks in advance.
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)
I am trying to connect MongoDB database manually. So how is it possible to get the collection in MongoDB. I need to implement the code in custom js file and not in bootscript. If I include server.js file the problem is the entire application including the web server, boot scripts, etc, runs for the duration of the script, which means I'd have two instances of the app running.
So is there any way to manually integrate MongoDB and fetch documents in a collection.
Any help would be really appreciated.
Thanks in Advance
Set app variable to global and when bootscript is loaded first, set that global app variable to true and put an if condition for checking global app variable. If its set to true then return. Hope this will fix your issue.
I am writing service using NodeJS + Restify. I have split each actual service into separate file (what, I assume, everyone is doing). They all are going to be using mysql database so I thought I could open a single connection to database which could be used by each service rather than opening connections every time a request is done.
The problem is that I don't seem to find a way to pass user data. By user data I mean any custom data that would be accessible by every service callbacked by the server.
I primarily use NodeJS + Express, but having looked through some of the documentation of Restify, I believe you could use the authorization parser (under Bundled Plugins on their site: click here to go there)
I think that would be the most basic way to pass user data.
I haven't tested it but, I believe you'd just add this to use it:
server.use(restify.authorizationParser());
You could then access the user data with:
//This is based on the structure of req.authorization in the documentation.
req.authorization.basic.user
I believe you could set new user data (when the user logs in or something) like:
req.authorization.id = 'id'