Это видео недоступно.
Сожалеем об этом.

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

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2016
  • 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...

Комментарии • 137

  • @Doschia
    @Doschia 7 лет назад +127

    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 лет назад +20

    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!

  • @kiciafu
    @kiciafu 5 лет назад +9

    "Thank you for your word... but let's look at.. aa crashed.." this guy is brilliant ;)

  • @JoshAharonoff
    @JoshAharonoff 7 лет назад

    Incredible, 10/10. You have a real knack for teaching - us aspiring coders need more guys like you!

  • @lifeofkiran6285
    @lifeofkiran6285 3 года назад

    @1:30 i needed that dumb down explanation man thank you!!!!!!

  • @kira-t
    @kira-t 3 года назад

    Youre so excited, that makes it look and feel so much easier to start with it

  • @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 года назад +1

    6:33 😂😂never seen such vibes in any programming video, I love it

  • @sayonarabeats9048
    @sayonarabeats9048 5 лет назад +1

    Figured I didnt even need this video...
    Watched it till the end, I was just entertained okay.

  • @iliketocode6986
    @iliketocode6986 4 года назад

    nice explanation of sync/async and dint need hours to explain it you are a wizard.

  • @ddzeus9269
    @ddzeus9269 2 года назад

    Incredible video even in 2021

  • @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

  • @aetherwebdev3620
    @aetherwebdev3620 4 года назад +12

    1:12 Most Satisfying sound ever!!!

  • @TheLEEMINJONG
    @TheLEEMINJONG 7 лет назад +3

    This was exact tutorial that I was looking for! :) Thank you for walking us through for this awesome project!

  • @iamsachin619
    @iamsachin619 3 года назад

    you are a blessing to humankind!

  • @VOIRmusic
    @VOIRmusic 3 года назад

    How can i delete certain object in an array with its index then reassing all indexes in the array

  • @halilnevzat
    @halilnevzat Год назад

    i will remember you for the rest of my life

  • @ACaruso
    @ACaruso 7 лет назад

    This is awesome. Best online course in years.

  • @user-vd5im2mx5g
    @user-vd5im2mx5g 3 года назад

    This is exactly what I have been looking for!

  • @cronosramm
    @cronosramm 5 лет назад +1

    Excellent video bro!! thanks for that.. thanks!

  • @Gigatless
    @Gigatless 4 года назад +1

    I love and hate this guy at the same time.

  • @ffgcvs
    @ffgcvs 3 года назад

    Very good explanation! Thank you!

  • @yuvrajagarkar8942
    @yuvrajagarkar8942 3 года назад

    great teaching I really liked the way he teaches , great content

  • @kisekinomahou
    @kisekinomahou 7 лет назад

    Quality video, quality teacher. Thank you.

  • @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",
    }
    }

  • @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..

  • @yamelamadorfernandez7416
    @yamelamadorfernandez7416 4 года назад

    Your energy to teach is ten times greater than the energy Elon musk is using to power SpaceX rocket engines :D You rock man!

  • @ankitgupta9548
    @ankitgupta9548 4 года назад +1

    how to convert simple JavaScript file to node.js file?
    I want to know the conversion process?

  • @elfran_03
    @elfran_03 6 лет назад +1

    Thanks for the explanation.

  • @4ia06_ridhomuhammad6
    @4ia06_ridhomuhammad6 3 года назад

    i m so glad find out your channel

  • @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_

  • @Hasan_Nawaz354
    @Hasan_Nawaz354 6 лет назад +1

    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.

  • @cpcorvers
    @cpcorvers 6 лет назад +1

    Thanks for your great work!

  • @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

  • @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?!

  • @sIMP37
    @sIMP37 3 года назад

    How do you save long text? like a long text from the user?

  • @riigel
    @riigel 2 года назад

    Great tutorial! thanks!
    What if I want to change the value of a key?
    how can I do that?

  • @hazamuna2611
    @hazamuna2611 6 лет назад +1

    Thanks a lot for your work!

  • @rajakota4544
    @rajakota4544 Год назад

    What if json file has empty data and we need to read the data and add the data into it

  • @phanta5m
    @phanta5m 4 года назад

    Thank you, this is what i looking and wonder can i somehow save to portable format like JSON.

  • @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");"

  • @anujshaan1006
    @anujshaan1006 2 года назад

    This guy looks like the professor (Money Heist) and even explain all details like him . How I was not here earlier?

  • @ValchyGaming
    @ValchyGaming 6 лет назад

    Why do I get "SyntaxError: Unexpected token ' in JSON at position 0" even though i used readFileSync?

  • @Susul-lj2wm
    @Susul-lj2wm 4 года назад

    this is exactly what I needed!

  • @khalidhamza7651
    @khalidhamza7651 Год назад

    error : always i find this error in console Uncaught ReferenceError: require is not defined : const fs = require('fs');
    any help

  • @love.ly.
    @love.ly. 5 лет назад +1

    Very helpful!

  • @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?

  • @adamsh5391
    @adamsh5391 4 года назад

    The best of the best thank you for this tutorial!!

  • @Reility_
    @Reility_ 3 года назад

    fs package is no longer available so what other package can we use?

  • @elhoussainbiri3089
    @elhoussainbiri3089 3 года назад

    const fs = require('fs')
    Given me an error, how do I fix it?

  • @christianejikeomeje3145
    @christianejikeomeje3145 5 лет назад

    This amazing, you are a great teacher, what if i want to update a particular property, of the json file

  • @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.

  • @toshisharma603
    @toshisharma603 6 лет назад

    thank you so much. it was really helpful.

  • @swatilekha_roy
    @swatilekha_roy 3 года назад

    Thank you so very much

  • @devinternalta
    @devinternalta 8 месяцев назад

    I was just using github copilot in vs code and it randomly autocompleted with this video

  • @nicositepu3140
    @nicositepu3140 6 лет назад

    great work bro.....can u make a video about "using method from dynamic link library (dll) from node", thank you

  • @johnburney_hotdog9941
    @johnburney_hotdog9941 2 года назад

    Thanks, man.

  • @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

  • @PetrosPollakis
    @PetrosPollakis 5 лет назад

    Hello! Great tutorials but can you recommend any tutorial with the 4 choice where i can save data in data base?

  • @allisonfernandez2942
    @allisonfernandez2942 6 лет назад +2

    You're awesome!

  • @SogMosee
    @SogMosee 7 лет назад

    This was incredible.

  • @angshu7589
    @angshu7589 5 лет назад

    Nice video, but is there a way to get the user input from a textarea or such?

  • @GuillermoBasombrio
    @GuillermoBasombrio 4 года назад

    how to do this on angular 9/10? FS is deprecated?

  • @youtubecreaters-g6s
    @youtubecreaters-g6s 6 лет назад +1

    Superb

  • @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.

  • @EternalLegionGaming
    @EternalLegionGaming 6 лет назад

    Thanks! This is helpful. But how can I fetch data from an API and save it with this?

  • @yoeriyoeri4264
    @yoeriyoeri4264 5 лет назад +1

    The entire file overwrites itself, any ideas?

  • @olasoderlind5685
    @olasoderlind5685 7 лет назад

    if i use php how do i send a post and revers whit $_POST[....];

  • @CarelessMiss
    @CarelessMiss 6 лет назад

    How do I make fs.writeFile add and not replace?

  • @EthanSteveOfficial
    @EthanSteveOfficial 7 лет назад

    What about of typescript??I cant get the correct syntax with npm!

  • @tusharmaurya1668
    @tusharmaurya1668 7 лет назад +1

    Pls sir make video on NEDB on Electron.

  • @theartofcoding6024
    @theartofcoding6024 4 года назад

    you are awesome sir : )

  • @Mouthwvsh
    @Mouthwvsh 6 лет назад

    Great video!

  • @2912kamil
    @2912kamil 7 лет назад

    how to do it with input form instead req?

  • @DuskoPejacki
    @DuskoPejacki 6 лет назад

    "Hey, wanna hear the most annoying sound in the world?"1:12 :D

  • @harshitjoshi3082
    @harshitjoshi3082 6 лет назад

    But why do you have to stringify the JSON data ?

  • @BUCKTHEWORD14
    @BUCKTHEWORD14 7 лет назад

    Can you do a playlist on Node, Express and MongoDB please? Thanks.

  • @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

  • @onilkabbo4073
    @onilkabbo4073 5 лет назад

    Is it possible to make rest api using json???

  • @oscarstorm4694
    @oscarstorm4694 6 лет назад +1

    Amazing content, 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!

  • @ekser-thanksfor50ksubscrib72
    @ekser-thanksfor50ksubscrib72 4 года назад

    Text file as database? I see where Twitter got inspired.

  • @mohamedabdelmoneim5721
    @mohamedabdelmoneim5721 3 года назад

    GREAT!!!!

  • @BierGarten100
    @BierGarten100 5 лет назад +1

    And how is the data change ? :D

  • @IlhanNegis
    @IlhanNegis 7 лет назад +23

    even on whiteboard, you should start your lists from 0!

    • @TheCodingTrain
      @TheCodingTrain  7 лет назад +4

      +İlhan Neğiş haha good point!!

    • @MichielP1807
      @MichielP1807 7 лет назад +4

      0! = 1 so he did it right

    • @mariothrowsfireballsuntitl1841
      @mariothrowsfireballsuntitl1841 7 лет назад +1

      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

  • @geelemo
    @geelemo 5 лет назад

    you could just require the 'words' file or import for es6 syntax

  • @BananaTuTsWeb
    @BananaTuTsWeb 6 лет назад

    Could you use a MySQL database?

  • @manikantareddy2385
    @manikantareddy2385 5 лет назад

    love it

  • @poopman8837
    @poopman8837 7 лет назад +1

    you're amazing :D

  • @fastwayschool8340
    @fastwayschool8340 5 лет назад

    On my pc is require not working

  • @eugeniogonzato
    @eugeniogonzato 5 лет назад

    Thank you!!!!!!

  • @marcofernandes7607
    @marcofernandes7607 7 лет назад

    Amazing!!!

  • @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

  • @zvebrstremnyj6863
    @zvebrstremnyj6863 3 года назад

    Thanks from Ukraine!

  • @leevihalme4300
    @leevihalme4300 6 лет назад

    late, but you could do "nodemon file.js -e .js" and it won't restart to .json file changes

  • @jooj_kk
    @jooj_kk 5 лет назад

    script download link?

  • @hillaryjasel
    @hillaryjasel 4 года назад

    I cant use fs in react.
    I got an error no matter what :(

    • @Shadyholic
      @Shadyholic 4 года назад

      You can't use fs in react, you can use fs in node.