Тёмный

2.4 Saving to a Database - Working with Data and APIs in JavaScript 

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

💻github.com/CodingTrain/Intro-...
It's time to add a database! Let's learn why databases are important. For this video, I'll start by using NeDB for the Data Selfie App.
🔗 NeDB: github.com/louischatriot/nedb
🎥 NEXT LESSON: • 2.5 Database Query - W...
🎥 PREVIOUS LESSON: • 2.3 HTTP Post Request ...
🎥 FULL COURSE: • Working with Data and ...
🎥 Socratica - SQL for Beginners: • SQL - A Quick Overview...
🎥 What is Firebase?: • 9.1: What is Firebase?...
🚂 Website: thecodingtrain.com/
💖 Patreon: / codingtrain
🛒 Store: www.designbyhumans.com/shop/c...
📚 Books: www.amazon.com/shop/thecoding...
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...

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

 

3 июн 2019

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 149   
@lilrex2015
@lilrex2015 5 лет назад
I love this particular video series. I hope you continue on with videos that fit more business purposes like this. It is helping so much.
@seongmoon6483
@seongmoon6483 5 лет назад
This was really helpful!! Love it when you talk about the basic, fundamentals stuff because that is what I lack and everyone seems to know everything
@matthewperlman2281
@matthewperlman2281 4 года назад
this is maybe the most helpful video i have ever seen! I have been trying to learn sever side programming for several month with nothing, but from watching this series for a day, I created my first working project. Thank you so much you teach content in such a viewer friendly way.
@nate1988
@nate1988 2 года назад
I watch these videos like some people watch people play video games. This stuff is borderline addictive and I love it. Knowledge yo.
@seal0faproval
@seal0faproval 4 года назад
I cant believe this course is free?! Amazing work this would easily be $200+ on udemy
@hadrien06
@hadrien06 5 лет назад
Thanks a lot. You're a fantastic teacher and today I just started to learn NeDB with your tutorial. As we say in my country : Merci beaucoup ! :)
@gschincariol
@gschincariol 3 года назад
This is awesome. Really. This is awesome. I've been cracking my head around trying to understand how to 1 - make a server with node.js (quite simple, but it does not help when you can set it up, but can't use it for anything) 2 - make requests to that server / send data to that server 3 - manipulate the requests/data sent. your videos are amazing. for someone who has less than 6 months of experience with any coding language whatsoever, this has been the most elucidative and complete content I've seen. thanks!
@cm3462
@cm3462 9 месяцев назад
I have returned to this series so many times. What a good job you did, thank you and bravo.
@RicoGalassi
@RicoGalassi 5 лет назад
Yes yes yes. Definitely needed this video!!!👍🏼
@nebula4784
@nebula4784 3 года назад
your course is amazing . Easy to understand and quite handy thank you for providing this
@PieDente
@PieDente 5 лет назад
Thank you so much. Your videos are honestly so helpful and I would've failed my exam without you.
@quaternion-pi
@quaternion-pi 5 лет назад
Amazing content by a fantastic teacher. Thanks for your enthusiastic explanations; a brilliant teaching technique using novelty holds the viewer's interest. More teachers should employ it.
@watchoutusucka
@watchoutusucka 4 года назад
This is awesome thank you so much for creating this content! :)
@oliverrochester591
@oliverrochester591 2 года назад
Unbelievably helpful you are literally the greatest teacher I have ever seen
@roku1892
@roku1892 3 года назад
I love the type of this video ❤️ Thanks for making this tutorial 😊
@MichaelSartore
@MichaelSartore 4 года назад
@ 2:17 Sold! Seeking something simple to save simple user states.(said. 5xFast) Found it in this invigorating lesson! On to the next!
@heshamh2920
@heshamh2920 3 года назад
Finally someone solved my issue, I was looking for this topic for weeks , How to store data and not loosing them This is one is very easy very practical for beginner without the need of learning mongodb or sql Very important step to practice
@heshamh2920
@heshamh2920 3 года назад
Thank you man
@ThatGuyDownInThe
@ThatGuyDownInThe 4 года назад
this was so amazing to learn. mind is blown
@jassisingh672
@jassisingh672 4 года назад
The best teacher on youtube who teaches nodejs
@audweb5193
@audweb5193 Год назад
I love that! Thank you!
@rizkahn5133
@rizkahn5133 5 лет назад
Thank you. You make it look easy. How can you save data for example from a form in a sidebar chrome extension to your database.
@mszivatz
@mszivatz 3 года назад
Your courses are perfect, I love it! I have learned so much from it! But I have a question, is it possible to do this with p5.js? (I love programming with Processing or p5js. And I want to visualize data from mongoDB with p5js. I use node-red to collect the data)
@BRP-Moto-Tips
@BRP-Moto-Tips 3 года назад
How come anytime I'm hit with a doubt one of your videos pop right up? Thanks dude you're practically playing advisor out here
@thecoffeegod
@thecoffeegod 5 лет назад
Would definitely love a beginner's SQL guide!
@SangharshSeth
@SangharshSeth 4 года назад
super helpful you are the best teacher for beginner like me.
@jrichalot
@jrichalot 4 года назад
I think the key question this episode raises is "How the h*** do you include emoji's in the VSC editor?" As always, a brilliant video. I hope everyone realises the huge amount of work that goes in these. I do. You're a super teacher Dan.
@TheNewGreenIsBlue
@TheNewGreenIsBlue 2 года назад
Remap the symbols dialog to the fn key
@johncerpa3782
@johncerpa3782 5 лет назад
Great video.
@BrettCooper4702
@BrettCooper4702 5 лет назад
I really like this style of database for my own projects because because it doesn't need a DB service to be running alongside the application. lokijs.org/ is another DB like NeDB, it feature in-memory document-oriented datastore. So the loki_DB files is in the computer's ram and when changes are made to the loki_DB a copy in written to the HD/SSD drive.
@TheCodingTrain
@TheCodingTrain 5 лет назад
Oh, thank you for the tips!
@crustycock593
@crustycock593 5 лет назад
Have you made a video about MongoDB and express.js?
@ashvinikakade769
@ashvinikakade769 3 года назад
Great dear, keep it up
@jhalmu
@jhalmu 4 года назад
Hmm. When I had this like in video, it wrote to file, but in svelte, I can not write it to file but only in Indexed Db. So values are not safe in file, only in browser?
@jessehopkins116
@jessehopkins116 3 года назад
How do you save a file to a database I've been trying to figure this out for months I really need your help
@palmtree44444
@palmtree44444 5 лет назад
Please do this with a relational database. Primarily parsing nested Jason and inserting it into a table… Or tables
@aaronargottelopez3488
@aaronargottelopez3488 Год назад
Thanks!
@leonromo523
@leonromo523 3 года назад
Is there a way you can get data from the client from an HTML form for example from a login form and store it in a database?
@hydracreate7695
@hydracreate7695 4 года назад
How would I delete or edit data in the database?
@lonewolfcoding5208
@lonewolfcoding5208 3 года назад
can i use this locally inside the assets of android studio so i can use html interface to display inside the webview?
@robertbornschein5583
@robertbornschein5583 4 года назад
I don't know how these videos have dislikes, thank you!
@bpc1026
@bpc1026 4 года назад
You say you will make a link in the description to an example of saving the temporary database array to file but I don't see it anywhere.
@dazai_dev
@dazai_dev 5 лет назад
there's also MongoDB Atlas, provided by Mongo themselves, also a cloud database service
@shadealan1899
@shadealan1899 2 года назад
so when u inserted ur own data to output at 6:32, could you replace the lines with data from an API that your working with? For example if I was using a fortnite tracker API and I wanted to output the inserted fortnite username, their wins, and total kills would that work?
@prashantyadav-uo9mt
@prashantyadav-uo9mt 3 года назад
this just saved my hour of google search
@goodclover
@goodclover 5 лет назад
May I ask why Jan 1 1970 in particular alot of languages like python have a similar date for the milliseconds function, was it when that function was added to JavaScript?
@codeforest9027
@codeforest9027 3 года назад
No, Jan 1 1970 is considered the Unix epoch; this date is considered "arbitrary". To me, it seemed like they decided on a "round" date that was close. JavaScript was, in fact, created much later.
@yifengyuan1541
@yifengyuan1541 2 года назад
Is it possible to let the client side enter the database information, so they can specify which database they want to interact with?
@nethakasandamith7152
@nethakasandamith7152 2 года назад
So can i insert this in a different .js file besides the one im going to run?
@danielramalho7525
@danielramalho7525 4 года назад
I just want to get all the scores of all users, and in the end of the game put a new score in that info... data base is recommended for this situation?
@thejeffmorrison
@thejeffmorrison 5 лет назад
I feel like the database would get huge during testing. Are you considering checking if the lat/lon already exists in the db and either updating it, or not inserting if it does?
@BrettCooper4702
@BrettCooper4702 5 лет назад
yes, the images are doubled in size when they get Uuencoding, but the example of DB use is good. No BD server running.
@franlestonramos
@franlestonramos 5 лет назад
Hey..Amazing content and learning tons! Does anyone know how I would tell the server to get the lat and lon and regular intervals say once every 30 seconds..but not in the client. In other words, once the server is up it automatically does this every 30 seconds. Would I use setInterval for this? Would I put this set Interval in an app.get route? Thanks in advance. Coding Train dude, don't know your name but this is great content! Cheers!
@talha2
@talha2 3 года назад
I believe the server needs a request from a client to do something. The client has to send that information, it cannot be extorted. So you would have to use a setinterval in the client side code to get this result.
@danny_the_K
@danny_the_K 7 дней назад
So since NeDB is now an abandoned package and not maintained anymore, what would you switch to? Or would you just go ahead and use it anyway?
@harshilparikh2018
@harshilparikh2018 3 года назад
How to use databses in processing?
@susilo5667
@susilo5667 3 года назад
Could you please help me how to save the real time data into database
@abdelhaksaouli8802
@abdelhaksaouli8802 3 года назад
how to send text in body, i want to send an text so i can save it in txt file on server ?
@tambolaking5383
@tambolaking5383 5 лет назад
What are the practical uses of nedb other than in learning projects?
@TheNewGreenIsBlue
@TheNewGreenIsBlue 2 года назад
Prototyping. Sometimes you just need something quick and easy to showcase an idea without building out an entire database.
@SandFoxling
@SandFoxling 5 лет назад
correct me if I'm but MLab is now MongoDB Atlas. I got redirected to Atlas when trying to access MLab
@gerritschmittel6980
@gerritschmittel6980 3 года назад
How he make the button send the data?
@viditsinghbrahmania1476
@viditsinghbrahmania1476 3 года назад
I am using Linux right now. But the npm commands to install do not work without the --save option as you told in the video(4:18). I mean they work, stuff gets downloaded but it does not show up in the packages file. Any reason boys? The tutorial is amazing though. I feel myself to be so lucky to be young and energetic when great teachers like you are making content for free. I hope I would be able to learn it all.
@codeforest9027
@codeforest9027 3 года назад
Easy explanation for an easy db. also 100th comment
@kiranpande7407
@kiranpande7407 6 месяцев назад
When did He coded and connected the submit button
@khw9082
@khw9082 4 года назад
I am following your code, but I am having issues while dealing with this database. Every time I reboot my computer, I can't insert any data into my database after that. And when I am making get request with fetch api, there's not getting back any data. And the browser console tells me that 304 message in network box.
@s_sloven14
@s_sloven14 3 года назад
Same here. did you solve this
@ViswasHaridas
@ViswasHaridas 5 лет назад
Amazing video as always Dan! NeDB seems like a really nice and easy database to start with, but for people too lazy to do even that, I *highly* recommend jsonstore.io. You don't even need a server to set it up, you can just send it your data and request it anytime! Maybe mention this sometime, it might help out someone :P
@TheCodingTrain
@TheCodingTrain 5 лет назад
Thanks for the tip!
@ViswasHaridas
@ViswasHaridas 5 лет назад
@@TheCodingTrain Anytime! ^^
@englucasmendes
@englucasmendes 2 года назад
can some help me!!! i need to get data from a json and save then
@SankarJankoti
@SankarJankoti Год назад
Is there any db without npm and can work with javascript
@dev_insights101
@dev_insights101 4 года назад
how can we install it in windows???
@shubhamrathod5933
@shubhamrathod5933 4 года назад
How did you get that emoji in vscode ? BTW nice playlist
@bikramneupane1818
@bikramneupane1818 4 года назад
Look here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-D6BFRY5yrcY.html
@sigmiami
@sigmiami 3 года назад
Why did you over complicate sending a post with fetch?
@kantyDarius
@kantyDarius 5 лет назад
Awesome as always!!... Stupid question: what extension do you use to insert those emojis?
@vitalir2522
@vitalir2522 5 лет назад
Use the keyboard shortcut "Command - Control - Spacebar" to access emoji.
@nicksullivan23
@nicksullivan23 5 лет назад
@@vitalir2522 Any ideas how to get this working on Windows 7? I've added an extension which generates the following for rainbow \u{1F308} but I don;t get the emoji icon displayed in the editor or the pop up emoji menu? Nice feature which I'm guessing might be Mac only?
@emonymph6911
@emonymph6911 2 года назад
Good sir can you show us how to move data from a web component to a postgresql DB? :O
@ivansakal1224
@ivansakal1224 5 лет назад
So, NeDB to MongoDB is like SQLite3 to PostgreSQL?
@BrettCooper4702
@BrettCooper4702 5 лет назад
NeDB doesn't need a DB service running, which are a lot of boilerplate on the purpose of the tutorial.
@kennethgatewood4415
@kennethgatewood4415 2 года назад
if anyone is still around watching these i have a question, so i made an input for users and when they submit the data i get it but why is it separated from the latitude and longitude??
@igotapochahontas
@igotapochahontas 3 года назад
Coding train is the "bill nye the science guy" of my adult life.
@slyrockyballboa
@slyrockyballboa 3 года назад
Can someone share code for REST delete and update
@agata0214
@agata0214 4 года назад
8:30 I am confused. Isn't timestamp const? how can it be redefined as data.timestamp?
@valerabaglej7437
@valerabaglej7437 4 года назад
Yes, it's constant for every other request
@xulum1299
@xulum1299 3 года назад
somebody can send me this, but with user input? i tried but this don't works. please help me!
@anthonytonev1357
@anthonytonev1357 5 лет назад
If I upload app to heroku, will database file get saved and can it be accessed?
@TheCodingTrain
@TheCodingTrain 5 лет назад
The way I implemented in this video it is that when I deploy to Heroku a new database is created.
@Its.a_me_
@Its.a_me_ 5 лет назад
Hey which text editor do you use
@basilbaby2069
@basilbaby2069 5 лет назад
Microsoft Visual studio
@VBKing2
@VBKing2 5 лет назад
It is Visual Studio Code... Free download from Microsoft at: code.visualstudio.com/
@geraldladouceur4275
@geraldladouceur4275 5 лет назад
Sheefmahn! lol
@L76videos
@L76videos 5 лет назад
NeDb is not developed since many years. is it still a good package?
@filipbp7028
@filipbp7028 5 лет назад
I think you should only use for testing since some functions isn't fully optimized But as Daniel said it's a good place to start and begin to learn and develop further
@TanukiTan
@TanukiTan 5 лет назад
@@filipbp7028 yep, i agree, just don't use on big project.
@weler2491
@weler2491 2 года назад
0:38 what sound was that
@CyborusYT
@CyborusYT 5 лет назад
7:58 "So the latitude and longitude is coming in from the server" Isn't it coming from the client, or are you talking from the database's perspective?
@TheCodingTrain
@TheCodingTrain 5 лет назад
Yes, this is indeed confusing! Here I meant the save latitude and longitude coming in from the server.
@CyborusYT
@CyborusYT 5 лет назад
@@TheCodingTrain Ah, thanks for the clarification. :D
@TylerMatthewHarris
@TylerMatthewHarris 5 лет назад
Has he done a video on hilbert curves?
@TheCodingTrain
@TheCodingTrain 5 лет назад
No! Feel free to suggest here! github.com/CodingTrain/Rainbow-Topics/issues
@gnorken
@gnorken 2 года назад
Why is he creating the timestamp on the server side and not the client side? Why not add it to the html submit button?
@enivaldobonelli
@enivaldobonelli 4 года назад
For me, installing nedb without --save does not include it in the dependencies...
@TheCodingTrain
@TheCodingTrain 4 года назад
Maybe you are on an older version of node?
@enivaldobonelli
@enivaldobonelli 4 года назад
@@TheCodingTrain Working noe, thanks.
@s_sloven14
@s_sloven14 3 года назад
Cant fetch to database.db
@grainfrizz
@grainfrizz 5 лет назад
Dan, can you please share the code to creating the submit button and assigning the function to call when it is pressed? Sorry I'm new to HTML and JS.
@BrettCooper4702
@BrettCooper4702 5 лет назад
Did you try to google for that Astillero, that's been done many many times, good luck.
@grainfrizz
@grainfrizz 5 лет назад
@@BrettCooper4702 Googling now, Cooper. Thanks!
@TheCodingTrain
@TheCodingTrain 5 лет назад
Did you figure it out? You should be able to find everything here github.com/CodingTrain/Intro-to-Data-APIs-JS/, if something is missing file an issue!
@seismicoz
@seismicoz 3 года назад
if you have a huge amount of depression.js files in your IDE, here is the solution in this channel!
@yashinnews
@yashinnews 3 года назад
I have just found you How lucky I am
@luciamumma9899
@luciamumma9899 2 года назад
is nedb still functional?
@TheCodingTrain
@TheCodingTrain 2 года назад
It still works for me but I do see on GitHub that is no longer actively maintained
@kaungmoonsan9710
@kaungmoonsan9710 2 года назад
how come I found out this video so late ?
@abcrtzyn
@abcrtzyn 5 лет назад
He gave us a time stamp, we can figure out when he recorded this video
@filipbp7028
@filipbp7028 5 лет назад
24. April
@spontaneousjr.8351
@spontaneousjr.8351 3 года назад
new database is not creating automatically
@ugolapa7954
@ugolapa7954 5 лет назад
Do you use a macbook pro or air?
@adrianwalker9917
@adrianwalker9917 3 года назад
If anyone ever figures out how he got timestamp written to the logs by just defining it with data.timestamp = timestamp; please let me know. Update: I just figured it out -> See below. I added this for testing purposes: const my_name = "testing_log"; data.name = my_name; and it gave: {"lat":"45.781","lon":"-66.153","timestamp":1615000136688,"name":"testing_log","_id":"U4oVussKfAaXJyQB"} I added this: const rnd = "random_words_here" data.whattheheck= rnd; and it resulted in: {"lat":"45.781","lon":"-66.153","timestamp":1615000540332,"name":"testing_log","whattheheck":"random_words_here","_id":"XMThaUyzyJSIA1Xk"}
@jonathan-._.-
@jonathan-._.- 5 лет назад
Facepalm ive been using new Date().valueOf() for ages
@tokyo-code-girl
@tokyo-code-girl 3 месяца назад
nedb is now an abandoned project that raises critical vulnerabilities when attempting npm install 😢
@freshpootube
@freshpootube 4 года назад
I have an SQL database on my webserver. How can I use that?
@louis-philippekyer4335
@louis-philippekyer4335 4 года назад
npm mysql package ^^
@ETNewVideo
@ETNewVideo 3 года назад
Hey, is there any method to save data into same Id. Means update data again and again in same Id. Is this possible?? If yes then how??
@MrAFG02
@MrAFG02 4 года назад
Guys I cannot install nedb, because I’m behind a corporate proxy. How can I handle this problem? Thanks in advance
@johnmwansa4180
@johnmwansa4180 5 лет назад
mr danil pls can you creat one video 4 itunes bypass using pyhoni ur database
@grainfrizz
@grainfrizz 5 лет назад
Hi, Seeking for peer review PR: github.com/morethanyell/nodejs-tut/pull/5 Thanks. danny
@colindante5164
@colindante5164 2 года назад
Why are we declaring global variables (let lat, lon;)??? The pop up window for the client to allow access to the device's location should only come into question when pressing the submit button. Had the ' if ' statement been embedded in the event handler those global variables could have been declared locally. Why hasn't any of this been addressed ? Could you kindly explain what is it that's going on here.
Далее
These Coding Projects Give You An Unfair Advantage
14:39
This Is Why Python Data Classes Are Awesome
22:19
Просмотров 796 тыс.
Learn JSON in 10 Minutes
12:00
Просмотров 3,1 млн
Running a Buffer Overflow Attack - Computerphile
17:30
1.1: fetch() - Working With Data & APIs in JavaScript
15:39