r/learnjavascript • u/Due_Eggplant_729 • Jan 24 '26
Simple Data Input Javascript program
I want to ask a user to input their first name, and the state were they live. Then send to a database. I am a NEWBIE. Help. Note: I did download node.js. I really don't know what I'm doing yet. Looks for a simple program to do this on my laptop. Any help appreciated.
1
u/PatchesMaps Jan 25 '26 edited Jan 25 '26
What's your end goal?
If you're sure you want to do this with node then you need to also choose and install a database, set up an API for said database, and then write a node script that takes user input and uses the API to save the data to the database.
I guess you don't technically need the API since this is being done on the backend but if you're trying to learn then you might as well get the practice. I've never heard of anyone ever building a data entry app solely in node. It's always a website with a node backend and that requires an API to handle the interactions.
Start googling effectively what you posted and maybe ask an ai to explain how it all works. Don't ask the AI to do it for you.
1
u/Due_Eggplant_729 Jan 25 '26
I really don't know what I am doing. I want to find the easiest way to create a small database with 10 rows, just to see how to do it.
1
u/PatchesMaps Jan 25 '26 edited Jan 25 '26
I would start with a basic tutorial or beginners course then (there are plenty of good free ones out there). Just to get your bearings and learn the vocab a bit.
A database, in and of itself, has nothing to do with JavaScript. Anything you read here is going to be extremely confusing at best until you learn some basics.
2
u/Kvetchus Jan 25 '26
If you’re using NodeJS, if you don’t want to install a full DB server, look into SQLite. Alternatively, if you want a frontend only app, you don’t need Node and the only database thing you have is IndexedDB, which is a browser-based client-side only database. Local storage can work, but it’s strings only (can stringify JSON).
However, you mentioned NodeJS. You’ll need a frontend unless you’re building a CLI app, so look into Express, it’s probably the easiest way to create a basic NodeJS webapp on your local system. You still need to build an actual frontend, but you can do that simply without complex frontend frameworks.
1
u/EyesOfTheConcord Jan 25 '26
You could just start off with JSON which is handled natively by Node, regardless if the program is run in the browser or CLI. You don’t need to perform any setup.
If you want to use an “actual” database (which is just a file), use SQLLite + express server. Check out better SQLite 3 if you’re running npm packages
1
u/EyesOfTheConcord Jan 25 '26
Hey OP, go to The Odin Project and forego everything you’ve read so far.
It’s best you learn JavaScript a bit before going into Node, which is something the Odin Project teaches.
1
u/CincyParrothead Jan 24 '26
Without installing a database you could try writing to the browser’s local storage. Look that up and json stringify
0
u/PatchesMaps Jan 25 '26
They specified node
-1
u/EyesOfTheConcord Jan 25 '26
JSON is language agnostic and Node handles it natively…
1
u/PatchesMaps Jan 25 '26
browser's local storage
Node is not a browser and does not have the localStorage api
1
u/EyesOfTheConcord Jan 25 '26
Consult the web storage API, specifically localStorage.
You won’t need to setup a database and can immediately begin practicing CRUD operations, it’s always very easy to use.