Тёмный

8.5: Saving Data to JSON File with Node.js - Programming with Text 

The Coding Train
Подписаться 1,7 млн
Просмотров 225 тыс.
50% 1

In this video, I discuss how to work with a very simple database with in the API example using local JSON files and the node.js "fs"(file-system) package.
Next video: • 8.6: API Front End Cli...
shiffman.net/a2...
To know more on this subject, visit my material on Server-side Programming and Node: shiffman.net/a2...
Course url: shiffman.net/a2z/
Support this channel on Patreon: / codingtrain
Send me your questions and coding challenges!: github.com/Cod...
Contact: / shiffman
GitHub Repo with all the info for Programming from A to Z: github.com/shi...
Links discussed in this session:
Node.js: nodejs.org/
Node.js "fs" Documentation: nodejs.org/api...
Express.js: expressjs.com/
Source Code for the all Video Lessons: github.com/Cod...
p5.js: p5js.org/
Processing: processing.org
For More Programming from A to Z videos: www.youtube.co...
For More Coding Challenges: • Coding Challenges
Help us caption & translate this video!
amara.org/v/0WvN/
📄 Code of Conduct: github.com/Cod...

Опубликовано:

 

12 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 137   
@Doschia
@Doschia 7 лет назад
I love the way how you're teaching everything, you're always excited, happy and you can clearly see that you like what you're doing! And eventhough you are talking very fast, l can understand every single word! Thanks for that, keep the great work up.
@scronkfinkle650
@scronkfinkle650 7 лет назад
Hello Dan! I just want to say how greatly appreciative I am of all of this free and useful content that you're putting out. I am an aspiring developer who's signed up for virtually every eLearning site there is. They cover a lot of ground but you seem to be filling a void that's not common in these other generic sites. So I wish to thank you for filling that void. Keep up the tremendous work!
@quintilianodaletedeoliveir9656
@quintilianodaletedeoliveir9656 3 года назад
Hey Dan I invested many hours trying to realize hot to save data on a json file. It`s incredible the way u teach this. Thanks a lot!
@jascha_huisman
@jascha_huisman 4 года назад
I learnt so much more and faster watching your video's than reading all other documentation out there on the internet. Somehow, the things you say make a lot of more sense. Great explanation Daniel!
@lifeofkiran6285
@lifeofkiran6285 3 года назад
@1:30 i needed that dumb down explanation man thank you!!!!!!
@kiciafu
@kiciafu 5 лет назад
"Thank you for your word... but let's look at.. aa crashed.." this guy is brilliant ;)
@kira-t
@kira-t 3 года назад
Youre so excited, that makes it look and feel so much easier to start with it
@JoshAharonoff
@JoshAharonoff 7 лет назад
Incredible, 10/10. You have a real knack for teaching - us aspiring coders need more guys like you!
@LeetCodeSimplified
@LeetCodeSimplified 3 года назад
Wow, this is exactly what I was looking for! You're really a master at explaining things in a simple to understand way!
@nikamaisuradze8523
@nikamaisuradze8523 3 года назад
6:33 😂😂never seen such vibes in any programming video, I love it
@iliketocode6986
@iliketocode6986 4 года назад
nice explanation of sync/async and dint need hours to explain it you are a wizard.
@iamsachin619
@iamsachin619 3 года назад
you are a blessing to humankind!
@aetherwebdev3620
@aetherwebdev3620 4 года назад
1:12 Most Satisfying sound ever!!!
@commandblockgal7396
@commandblockgal7396 4 года назад
😏
@ddzeus9269
@ddzeus9269 2 года назад
Incredible video even in 2021
@ACaruso
@ACaruso 7 лет назад
This is awesome. Best online course in years.
@FriendlyNeighborhoodPrgrammer
@FriendlyNeighborhoodPrgrammer 2 года назад
I'll definitely reference this when I add permanent card saving to my discord bot! Thanks ive been looking for this for a while
@VOIRmusic
@VOIRmusic 3 года назад
How can i delete certain object in an array with its index then reassing all indexes in the array
@user-vd5im2mx5g
@user-vd5im2mx5g 3 года назад
This is exactly what I have been looking for!
@sayonarabeats9048
@sayonarabeats9048 5 лет назад
Figured I didnt even need this video... Watched it till the end, I was just entertained okay.
@TheLEEMINJONG
@TheLEEMINJONG 7 лет назад
This was exact tutorial that I was looking for! :) Thank you for walking us through for this awesome project!
@cronosramm
@cronosramm 5 лет назад
Excellent video bro!! thanks for that.. thanks!
@ffgcvs
@ffgcvs 3 года назад
Very good explanation! Thank you!
@yuvrajagarkar8942
@yuvrajagarkar8942 3 года назад
great teaching I really liked the way he teaches , great content
@4ia06_ridhomuhammad6
@4ia06_ridhomuhammad6 4 года назад
i m so glad find out your channel
@elfran_03
@elfran_03 6 лет назад
Thanks for the explanation.
@Gigatless
@Gigatless 4 года назад
I love and hate this guy at the same time.
@cpcorvers
@cpcorvers 6 лет назад
Thanks for your great work!
@oi_faen
@oi_faen 7 лет назад
love your videos :) i want to see you play around with geojson-data :) maybe on a map (some gis-thinghy) like leaflet..
@kisekinomahou
@kisekinomahou 7 лет назад
Quality video, quality teacher. Thank you.
@hazamuna2611
@hazamuna2611 6 лет назад
Thanks a lot for your work!
@halilnevzat
@halilnevzat Год назад
i will remember you for the rest of my life
@Susul-lj2wm
@Susul-lj2wm 4 года назад
this is exactly what I needed!
@love.ly.
@love.ly. 5 лет назад
Very helpful!
@producertalk5337
@producertalk5337 4 года назад
Hey thanks, filled some gaps in my understanding.
@Apfelwolken
@Apfelwolken 4 года назад
I really like your tutorials, but what I do miss is a link in the description to the *previous* video in the series. _/off looking through his hundreds of videos for 8.4_
@adamsh5391
@adamsh5391 4 года назад
The best of the best thank you for this tutorial!!
@allisonfernandez2942
@allisonfernandez2942 6 лет назад
You're awesome!
@theartofcoding6024
@theartofcoding6024 4 года назад
you are awesome sir : )
@SogMosee
@SogMosee 7 лет назад
This was incredible.
@swatilekha_roy
@swatilekha_roy 3 года назад
Thank you so very much
@toshisharma603
@toshisharma603 6 лет назад
thank you so much. it was really helpful.
@johnburney_hotdog9941
@johnburney_hotdog9941 2 года назад
Thanks, man.
@yamelamadorfernandez7416
@yamelamadorfernandez7416 5 лет назад
Your energy to teach is ten times greater than the energy Elon musk is using to power SpaceX rocket engines :D You rock man!
@adron115
@adron115 5 лет назад
Can you read the stored data you wrote a few seconds before without restarting the server before? That was just for showing, that the data isn´t gone after restarting, right?
@Hasan_Nawaz354
@Hasan_Nawaz354 6 лет назад
can you make a video about to sending a file on client request to a server and then this text file should be stored on the server and on request text file should be transferred to client(in my case it is logi pi and i want to upload bit files in logi pi with Raspberry Pi ) please ? I will be very grateful to you.
@ankitgupta9548
@ankitgupta9548 4 года назад
how to convert simple JavaScript file to node.js file? I want to know the conversion process?
@ValchyGaming
@ValchyGaming 6 лет назад
Why do I get "SyntaxError: Unexpected token ' in JSON at position 0" even though i used readFileSync?
@sIMP37
@sIMP37 4 года назад
How do you save long text? like a long text from the user?
@priyathirunavukarasu1562
@priyathirunavukarasu1562 5 лет назад
Hello Dan, Great work on the above. I just want to request your knowledge on something. I need to save a html table data in a file, where when the user clicks submit after entering the table data, the server has to create a file and store the table data in an excel format so that the user can view the data whenever he wants it, either online or he can download the file locally to his computer. I am learning node JS from your videos, and I would be excited if you could give some idea on how to approach this.
@dhirenpathak
@dhirenpathak 6 лет назад
Superb
@user-uk3ns3rz6o
@user-uk3ns3rz6o 2 года назад
Never understand node.js :/ Does google chrome support node.js or ? Got a lot of error, one of them are --> require is not defined. Just trying to make a basic game with a score that I want to save to JSON, right now I'm using Microsoft Visual Studio and have HTML as a live server to google chrome.
@Mouthwvsh
@Mouthwvsh 6 лет назад
Great video!
@franckelisabeth5694
@franckelisabeth5694 4 года назад
Hi thanks for the video, it's very interesting ! I have a question. Here you do that with node but how would you do to save a file on a server in a directory if you use your js in a website ? I think about send a request that contain my data but I don't know how and where to reach my data
@phanta5m
@phanta5m 4 года назад
Thank you, this is what i looking and wonder can i somehow save to portable format like JSON.
@angshu7589
@angshu7589 5 лет назад
Nice video, but is there a way to get the user input from a textarea or such?
@fash9340
@fash9340 3 года назад
Instead of load balancing, I would like to save get data and store it as text. There are times that my server crashes and it is not able to show the coming data and then move it to the database. Do you think firebase would be a solution?!
@christianejikeomeje3145
@christianejikeomeje3145 5 лет назад
This amazing, you are a great teacher, what if i want to update a particular property, of the json file
@riigel
@riigel 2 года назад
Great tutorial! thanks! What if I want to change the value of a key? how can I do that?
@nicositepu3140
@nicositepu3140 6 лет назад
great work bro.....can u make a video about "using method from dynamic link library (dll) from node", thank you
@neksodebe
@neksodebe 4 года назад
You didn't need to use fs to read from the JSON file. You could just do it like this: "var words = require("words.json");"
@PetrosPollakis
@PetrosPollakis 5 лет назад
Hello! Great tutorials but can you recommend any tutorial with the 4 choice where i can save data in data base?
@anujshaan1006
@anujshaan1006 2 года назад
This guy looks like the professor (Money Heist) and even explain all details like him . How I was not here earlier?
@tusharmaurya1668
@tusharmaurya1668 7 лет назад
Pls sir make video on NEDB on Electron.
@mohamedabdelmoneim5721
@mohamedabdelmoneim5721 3 года назад
GREAT!!!!
@DuskoPejacki
@DuskoPejacki 6 лет назад
"Hey, wanna hear the most annoying sound in the world?"1:12 :D
@sanjays8687
@sanjays8687 3 года назад
how to update the file when we have nested json object for Ex { "en-uk": { "browse_channel": "BROWSE CHANNELS", "channels": "channels", "video": "video", } }
@poopman8837
@poopman8837 7 лет назад
you're amazing :D
@Reility_
@Reility_ 3 года назад
fs package is no longer available so what other package can we use?
@rajakota4544
@rajakota4544 Год назад
What if json file has empty data and we need to read the data and add the data into it
@harshitjoshi3082
@harshitjoshi3082 6 лет назад
But why do you have to stringify the JSON data ?
@yoeriyoeri4264
@yoeriyoeri4264 5 лет назад
The entire file overwrites itself, any ideas?
@EternalLegionGaming
@EternalLegionGaming 6 лет назад
Thanks! This is helpful. But how can I fetch data from an API and save it with this?
@elhoussainbiri3089
@elhoussainbiri3089 3 года назад
const fs = require('fs') Given me an error, how do I fix it?
@vikasswamy3498
@vikasswamy3498 2 года назад
Sir... I had a task to push ID's and ID values to geojson file.... And convert that geojson file to svg.. please give me a solution to achieve the task
@khalidhamza7651
@khalidhamza7651 Год назад
error : always i find this error in console Uncaught ReferenceError: require is not defined : const fs = require('fs'); any help
@BUCKTHEWORD14
@BUCKTHEWORD14 7 лет назад
Can you do a playlist on Node, Express and MongoDB please? Thanks.
@CarelessMiss
@CarelessMiss 6 лет назад
How do I make fs.writeFile add and not replace?
@devinternalta
@devinternalta 9 месяцев назад
I was just using github copilot in vs code and it randomly autocompleted with this video
@EthanSteveOfficial
@EthanSteveOfficial 7 лет назад
What about of typescript??I cant get the correct syntax with npm!
@BierGarten100
@BierGarten100 5 лет назад
And how is the data change ? :D
@twitchizle
@twitchizle 5 лет назад
same
@manikantareddy2385
@manikantareddy2385 5 лет назад
love it
@marcofernandes7607
@marcofernandes7607 7 лет назад
Amazing!!!
@sinlg
@sinlg 5 лет назад
if there are many people adding new words into the JSON file, and many concurrent write to file, will there be data overwritting issue?
@sinlg
@sinlg 5 лет назад
i guess the API is only one listener.. if there were many (when you scale) then the data may be inconsistent across different instance of the listener
@GuillermoBasombrio
@GuillermoBasombrio 4 года назад
how to do this on angular 9/10? FS is deprecated?
@olasoderlind5685
@olasoderlind5685 7 лет назад
if i use php how do i send a post and revers whit $_POST[....];
@zvebrstremnyj6863
@zvebrstremnyj6863 3 года назад
Thanks from Ukraine!
@onilkabbo4073
@onilkabbo4073 5 лет назад
Is it possible to make rest api using json???
@eugeniogonzato
@eugeniogonzato 5 лет назад
Thank you!!!!!!
@leontheonly101
@leontheonly101 5 лет назад
how do you make the browser show JSON how how its usually written in a normal file and not like a simple string in one line?
@TheCodingTrain
@TheCodingTrain 5 лет назад
I use a JSON formatter chrome extension.
@leontheonly101
@leontheonly101 5 лет назад
@@TheCodingTrain Oh, ok cool :D, thank you!
@BananaTuTsWeb
@BananaTuTsWeb 6 лет назад
Could you use a MySQL database?
@alexarsenev8805
@alexarsenev8805 5 лет назад
you rock!
@HimFinancial
@HimFinancial 6 лет назад
I like you, dude.
@geelemo
@geelemo 5 лет назад
you could just require the 'words' file or import for es6 syntax
@maweryoutube9852
@maweryoutube9852 5 лет назад
What is the name of the instructor, please. Full name
@keegan.j1321
@keegan.j1321 5 лет назад
Go to his channel’s about page there’s links that you can find
@maweryoutube9852
@maweryoutube9852 5 лет назад
@Bobby Tarantino So I could see if he has any courses on Udemy.com His way of explaining things is amazing.
@IlhanNegis
@IlhanNegis 7 лет назад
even on whiteboard, you should start your lists from 0!
@TheCodingTrain
@TheCodingTrain 7 лет назад
+İlhan Neğiş haha good point!!
@MichielP1807
@MichielP1807 7 лет назад
0! = 1 so he did it right
@mariothrowsfireballsuntitl1841
Every time I see a sentence end with a number and exclamation point I read it as factorial of that number.
@gregsoares6021
@gregsoares6021 6 лет назад
lol, but is 0! = 1 ? proof ?
@uuu12343
@uuu12343 6 лет назад
Greg Soares if 5! = 5 x 4 x 3 x 2 x 1 4! = 5! / 5 3! = 4! / 4 .... 0! = 1! / 1 = 1 Proof
@szeredaiakos
@szeredaiakos 5 лет назад
Your random laughter makes me think you are slightly delirious, which makes me think there is a good chance you know your shit more than "normal" people.
@ekser-thanksfor50ksubscrib72
@ekser-thanksfor50ksubscrib72 5 лет назад
Text file as database? I see where Twitter got inspired.
@kayderl
@kayderl 4 года назад
Been looking for a tutorial on how to write my own JSON database. This is brilliant. Anybody know how I could integrate this method with GraphQL?
@happyfreeky
@happyfreeky 4 года назад
Cadell Teng if you have a REST API, it can be wrapped in GraphQL
@fastwayschool8340
@fastwayschool8340 5 лет назад
On my pc is require not working
@leevihalme4300
@leevihalme4300 6 лет назад
late, but you could do "nodemon file.js -e .js" and it won't restart to .json file changes
Далее
8.6: API Front End Client - Programming with Text
13:50
1.4: JSON - Working with Data and APIs in JavaScript
16:22
Дежавю, прескевю и жамевю!
00:59
Просмотров 198 тыс.
Faites comme moi
00:14
Просмотров 1,3 млн
Node.js is a serious thing now… (2023)
8:18
Просмотров 645 тыс.
Protocol Buffers Crash Course
36:07
Просмотров 244 тыс.
Coding Challenge 180: Falling Sand
23:00
Просмотров 908 тыс.
Read/Write JSON Files with Node.js
10:27
Просмотров 88 тыс.
Learn JSON in 10 Minutes
12:00
Просмотров 3,2 млн
I Stopped Using Express.js: Because Bun and Hono 🔥
10:23
Turns out REST APIs weren't the answer (and that's OK!)
10:38
~/.dotfiles in 100 Seconds
13:54
Просмотров 418 тыс.
Storing Images in S3 from Node Server
39:59
Просмотров 91 тыс.
Дежавю, прескевю и жамевю!
00:59
Просмотров 198 тыс.