Very nice tutorial both part 1 and 2! I have understood quite well. I have a few questions though: 1. How to add a loading progress in case a view takes longer to be loaded 2. How to load a view which has some custom scripts and CSS files links in it Answers to these two questions will be much appreciated @dcode
@मेबीराज2 жыл бұрын
Did you find any answer to 2nd question?
@chubbyBunny94 Жыл бұрын
i think these are pretty straight forward questions but yo, you've got chat GPT
@AyushSinghxda3 жыл бұрын
After all these years of SPA, it finally makes sense how things work under the hood. Great work!
@flexDevelop4 жыл бұрын
This is probably the most well done/explained video tutorial about SPA I've found in 2020. It's worth to mention the difference of how JS is processed on frontend JS files when compared with the server.js file (stuff such as require, etc). It would be also cool if you could do PWA integration (storage/websql). Keep up with the awesome work!
@dcode-software4 жыл бұрын
Appreciate that! Yes I've got a video on PWA but it could be an idea to combine the two 🤔
@fellipelorram43413 жыл бұрын
Definitely should do it
@amirhosseinveysi95463 жыл бұрын
Changed my life sir, tnx for making this video
@slackergeek20073 жыл бұрын
These 2 videos were great. I would love to see a continuation with the following: 1) pulling the HTML from there server using Fetch and a loading overlay and 2) rendering a 404 view for invalid routes. Or at the very least redirect back to Dashboard when the route is invalid.
@RashidAli-oc1sr2 жыл бұрын
Watch first part he told us about 404
@ginanjarseladipura39804 жыл бұрын
this tutorial should have thousands of likes. thank you for doing this!
@atleast_me3 жыл бұрын
Long live js king 👑. This is the ultimate explained video I've found on KZbin
@ThaRealIansanity2 жыл бұрын
This is great! I've been learing react but for academic reasons I was working on a static site with alpinejs that uses the fetch api with laravel sanctum. After several frustrating days I managed a successful login but it is still just a static site. I think with all I learned from you I can move forward and make it an actual SPA. Thank you!
@Jangeroo4 жыл бұрын
Really really great video. Also a great reminder to finally learn regex, it’s nothing but gibberish to me
@Rm-ey8xe4 жыл бұрын
Don't worry you still explained it well, Thank you very much for this great tutorial!
@vernatley2212 жыл бұрын
Great video and excellent teacher, for understanding how react works under the hood you leaves me feeling a little wiser. Ive one problem after following along. Dont want to just use your free code to understand why and how the problem exists. Everything is working exactly how should do apart from sometimes or mostly all times when traversing between links, the page is refreshing. Anyone?
@braddockbrawler6 ай бұрын
A third part would be nice, in which you connect to mysql, create posts, save posts and delete posts.
@braddockbrawler5 ай бұрын
1 month, no answer. This channel must be dead. Too bad, i liked it.
@socialpeople66152 жыл бұрын
Fantastic tutorial! Very good explanation, good design and valuable material. Thank you!
@gustavoexel4 жыл бұрын
Great video series, tks!!! One question: why don't we consider building the URLs with queries as "/posts?id=2&dcode=35" instead of "/posts/2/35" ? It'd be much clearer and easy to parse! Is there a definite reason why it's best not to use queries on SPA URLs?
@fomofonk2 жыл бұрын
Very informative videos (both 1 & 2)! I do have 1 question (and it might be a stupid one), how do you go about adding an actual post (like the ones shown at the beginning of this video)? (please excuse the beginner in me!)
@brandonjaus4944 жыл бұрын
Wow this was great! Thanks for the quality tutorial man; absolutely eye opening.
@2005Azm4 жыл бұрын
Simply awesome !
@robwatson8263 жыл бұрын
Now this has some clever stuff in it. I've always wondered but never actually looked into a client side routing engine before. Really good informative video and a nice solution. I didn't quite understand why right at the end you threw in that [location.pathname]? Seemed a bit rushed for no reason.
@yumdiddlyum4 жыл бұрын
Great tutorial! The regex stuff is a bit over my head currently but you explained everything else clearly enough that I got a good overall idea of how it all works. Thanks for the video!
@dcode-software4 жыл бұрын
Appreciate it! Thanks Kayla great to see you enjoyed
@netlity55323 жыл бұрын
@@dcode-software Very nice tutorial both part 1 and 2! I have understood quite well. I have a few questions though: 1. How to add a loading progress in case a view takes longer to be loaded 2. How to load a view which has some custom scripts and CSS files links in it Answers to these two questions will be much appreciated @dcode
@kamoroso9410 ай бұрын
For the pathToRegex function, you could use named capture groups to avoid having to extract the names again from the path in getParams.
@amguruprasath80374 жыл бұрын
Man we need a full-fledged framework tutorial
@dcode-software4 жыл бұрын
Now that could quite possibly be re-inventing the wheel! Haha
@arshiagholami76113 жыл бұрын
@@dcode-software I see nothing wrong here
@jeffreyclaybrook Жыл бұрын
I'm trying to loop through an array of restaurant menu items (Posts) and dynamically generate a unique item details page (PostView) for each item rather than manually creating a PostView file for each item and was wondering if you could point me in the right direction for learning how to best implement this. This begs the question -- have you considered making a part 3 to this series of tutorials?
@russianstan4 жыл бұрын
Thanks! It's just amazing!
@dcode-software4 жыл бұрын
All good!
@netlity55323 жыл бұрын
@@dcode-software Very nice tutorial both part 1 and 2! I have understood quite well. I have a few questions though: 1. How to add a loading progress in case a view takes longer to be loaded 2. How to load a view which has some custom scripts and CSS files links in it Answers to these two questions will be much appreciated @dcode
@blarvinius3 жыл бұрын
Very clear and thorough. Thanks! (You move rather quick, so it might be nice to have your mouse cursor highlighted...)
@compsguru2 жыл бұрын
Thanks for the tutorial , the first video was great . I just wish you didn;t get into the Regex area of it because it felt too advanced for the kind of people (me included) who are just starting off .
@vuejs1 Жыл бұрын
What patterns are you using in this vid?
@arqasr2 жыл бұрын
Hi, I love the two SPA videos, but I get stock. How I access the individual posts having a link on the Posts page? Do I need to create an individual file for each post? how?
@ГеоргиЧавдаров-в7з4 жыл бұрын
You are awesome! You are master!
@Mickey_McD3 жыл бұрын
How might you extends your framework to handle form input when each view could have its own form? Maybe each post could allow for a user to add a comment?
@relaxingmusic62803 жыл бұрын
Maybe use Ajax🤔
@marcelm7661 Жыл бұрын
Hi and thanks for the great vid! I learned a lot in this tutorial :) But I have one problem with my code. If i try to access to the /posts/:id route in my browser search bar I get a MIME Type error. If I am accessing it via link tag in my html it works totally fine. What could be a potential mistake I did?
@AleksandarIvanov694 жыл бұрын
So you if got an array of posts, you use this to populated the data from the array into the Post view, matching the post by id ?
@dcode-software4 жыл бұрын
Yep, pretty much!
@chimsgraphic3 жыл бұрын
Great video. How do I consumean api and pass to the view?
@vladosononame63763 жыл бұрын
this video is piece of gold in sea of internet shit, works fine! good foundation!
@050600242 жыл бұрын
Hi. I'm getting a strange behavior. If I insert a link inside the HTML returned by PostView.js, clicking on it shows the post as expected. However, if I enter the same URL localhost:5060/posts/23/4 in the address bar and hit enter, I still get one post displayed, but without any styling. When I look at the index.css returned in the Dev Tools, it has the contents that we put in index.html, instead. Any idea why this is happening?
@wewiwowo422 жыл бұрын
Hello I have this exact issue Did you figure it out?
@wewiwowo422 жыл бұрын
In dev tools as well as the index.html being loaded into the index.css the JS folder is not being laoded at all?
@wewiwowo422 жыл бұрын
Hey buddy I fixed this issue in the end. It was due to the folder path syntax. instead of using just static/css/index.css for the href in the style sheet. re. begin the file path with ../ example
@koitaki3 жыл бұрын
"Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems." - Jamie Zawinski But for those confused, Dom has a good video on RegEx at kzbin.info/www/bejne/d6PbgK2bdrSBfsk
@nicolaschvostal2 жыл бұрын
Why switching between dashboard posts and settings does not work for me, the dashboard will show, but when I press posts or settings it will show cannot get / posts or / settings. Thank you for support.
@amezan77773 жыл бұрын
HI, great video! But I didn't understand how to add posts. Could you explain? Thanks :)
@Thanveershah4 жыл бұрын
Is it a good practice to use SPA in Vanilla JS ? Looks so much complicated
@dcode-software4 жыл бұрын
For small projects, possibly - it's up to you. This is more for learning purposes 😁
@netlity55323 жыл бұрын
@@dcode-software Very nice tutorial both part 1 and 2! I have understood quite well. I have a few questions though: 1. How to add a loading progress in case a view takes longer to be loaded 2. How to load a view which has some custom scripts and CSS files links in it Answers to these two questions will be much appreciated @dcode
@aguileraq4 жыл бұрын
Great video. I really hope you can complement this SPA with firebase auth, it will be great. Thanks!!
@iglesiasleonardo17422 жыл бұрын
What if you need integration with a database? How will you manage both client and server-side? It can't be an app if it does not have any dynamic content
@youmee89563 жыл бұрын
Would i get request and response (req, res) in routes path?
@KostasOreopoulos4 жыл бұрын
With a few tweaks it can be made easier to understand and more compact we have as in the code const pathToRegexForValues = (path) => new RegExp('^' + path.replace(/\//g, '\\/').replace(/:\w+/g, '(.+)') + '$'); and we can define const pathToRegexForKeys = (path) => new RegExp('^' + path.replace(/\//g, '\\/').replace(/:\w+/g, ':(.+)') + '$'); which does almost the same but leaves out the : from the regExpression with the intention to capture just the name So now when we match we have return { route: route, matchedParamValues: location.pathname.match( pathToRegexForValues(route.path) ), // this is the same matchedParamKeys: route.path.match(pathToRegexForKeys(route.path)), // here we go the path we are looking for '/posts/:id' and extract everything after the : // for each occurence of : }; Everything else is the same. Now we go to the getParams function and we will have values = match.matchedParamsValues.slice(1) ; // since we renamed result to matchedParamValues keys = match.matchedParamsKeys.slice(1) ; and everything else stays the same.
@romuloalves93494 жыл бұрын
Ótimo vídeo parabéns 👏.
@wewiwowo422 жыл бұрын
Thoroughly enjoyed this video and found it very helpful thankyou. I did get stuck however with the pathToRegex. I get the following error when I try to go to localhost:5500/posts/2 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec. did anyone come across this ISSUE SORTED ALL GOOD
@daredevil_37 Жыл бұрын
getting the same error, how did you manage to solve it?
@rogerchan548 Жыл бұрын
Having th same issue. How did you solve it?
@5ikronoz3 жыл бұрын
รอ SPA #3 อยากรู้ว่าจะนำข้อมูลจาก data base มาแสดงใน SPA นี้ยังไง
@mingmeng0302 жыл бұрын
This is perfect tutorial for me! But I have an issue. My router works fine, but when I switch the page to postView, css isn't being applied at all. Does anyone know about this issue?!
@wewiwowo422 жыл бұрын
I have this same issue Did you find a dix
@mingmeng0302 жыл бұрын
@@wewiwowo42 not yet,,I searched everywhere but there’s nothing can help me. I think it can be react’s error
@wewiwowo422 жыл бұрын
@@mingmeng030 I actually figured it out. It was the syntax for me with the link ref for the style sheet. I had to use ../ at the start of the file path. Instead of just static/css/.index.css try ../static/css/index.css
@mingmeng0302 жыл бұрын
@@wewiwowo42 omg you saved me!! It also worked at my issue!! Thanks:)
@wewiwowo422 жыл бұрын
@@mingmeng030 awesome.
@shvrolet Жыл бұрын
i have one question. when i go /post/2 that's work but when i refresh the page all css is gone.Why that's happening?
@erfelipe3 жыл бұрын
Thanks
@_.sunnyraj._4 жыл бұрын
Please make a video on passport login using node
@adityamalviya51133 жыл бұрын
Very Informative video . Really very nice concept implemented . I am trying to make a web application referring your video . Thank you for the video . Trying to implement there's a problem came in front of me , When I navigate to dashboard/0 , the address of all static files changes . Mean to say , when the url is 'localhost:5000/dashboard/0' , then Images , css files which are having path 'localhost:5000/static/images/abc.png' changes to 'localhost:5000/dashboard/static/images/abc.png' , hence image doesn't displays in 'localhost:5000/dashboard/0' page . I just wanted to know , why this is happening ?
@dcode-software3 жыл бұрын
I made a video on this a while ago: kzbin.info/www/bejne/nIvNfJZooLJ-j7c
@adityamalviya51133 жыл бұрын
@@dcode-software Thank you for the reply . I now got understood what I was doing wrong . Thank you .
@adityamalviya51133 жыл бұрын
I came up with another question If you don't mind , I wants to know how to deploy this app on firebase . Having server.js and index.js both running . I hosted it on firebase the simple way any normal website is hosted . And after hosting it I found that index.js is running and server.js file is not running because redirecting after login failed which should reach to server.js . Instead 404.html is called . Observing this I can say that server.js is not running . How to host the application such a way that server.js should run along with index.js ?
@mr.o55773 жыл бұрын
Hi Dom sorry to bother mate but I have a bit of an issue, can you help? I built a SPA just like yours but now I face the deployment problem, now, how can I deploy a SPA just like the one you build on netlify or heroku? My problem is that the app has a backend where the routes are and the app needs it in order to hit the routes, i deployed all the files to netlify and heroku but no good, what to do? If anyone besides Dom in here knows please help me I am at lost.
@olutolamoses44163 жыл бұрын
I am having issues accessing the view pages In the dom. please assist
@rangabharath42534 жыл бұрын
awesome
@richardprakash46303 жыл бұрын
how do we handle JS in the views? example click event of a button
@casm1013 жыл бұрын
I've been making a site with this SPA method, and the solution is actually quite easy, after you run the router function on after the dom has loaded, you just need to run a function to apply your event listeners to current page, you can even pass the current path through the new function as a parameter to only load certain event listeners depending on the view you are loading!
@devindickerson96992 жыл бұрын
@@casm101 any chance you could tell me more how you handled the event listeners? I've been building a site with this method also and I'm am struggling with the event listeners for the views.
@casm1012 жыл бұрын
@@devindickerson9699 Hi, of course! I did it the following way: I have a separate file where I manage ONLY event listeners (for comodity, but you don't have to) and all the listeners are wrapped in a window.onload function to make sure they execute when everything is available, and inside I separate my listeners in groups that check if they correspond to the current site path, if so, they run, if not, they don't! Another way is to check if the element you wish to apply the listener to is visible on screen or not, which may be a better technically, depending on your application... Sorry for the late reply
@wewiwowo422 жыл бұрын
@@casm101 any chance of sharing the code you wrote for passing event listeners to the current page, I'm getting stuck trying to wrap my code in a window onload event function. I am still learning JS,. I keep on getting ye old 'cannot read properties of null'?
@wewiwowo422 жыл бұрын
Actually I fixed the Null reading error. for the window event listener. Though I am stuck on how pass the page path through so the click event wrapped inside works THIS IS my Code for handling the event I a huge Noobie. NAy help could be appreciated. window.addEventListener("onload", () => { if (route.path === ("/article")) { const techbtn = document.getElementById("techbtn"); const techinfo = document.getElementById("techinfo"); techbtn.addEventListener("click", () => { techinfo.classList.remove("nonvisible"); techinfo.classList.add("visible"); }); } });
@maheshYchhetri3 жыл бұрын
My page getting error when change route to /about and reload the page How can i fix this?
@Jangeroo4 жыл бұрын
What the router misses tho: route /posts/:id fully blocks /posts/:id/addComment
@hartono9583 Жыл бұрын
need tutorial how to run js script and fetch api in page example product.html ?
3 жыл бұрын
Where i can download the code?
@amguruprasath80374 жыл бұрын
how many more videos in this series?
@dcode-software4 жыл бұрын
As for right now, this is the last one.
@mohamedshehata3979 Жыл бұрын
how can i find Github Repo??
@anjanspace4 жыл бұрын
Hi , I am having problem in loading multiple HTML pages . Can you please help me. Is there any possibility of connecting with you via google meet. Pleaseeeee
@KostaTsourdalakis4 жыл бұрын
First! YADIGG
@urekmazino20862 жыл бұрын
Anyone else has the .matchAll(...).map() is not a function
@braswelljr4 жыл бұрын
finally
@heruhailiuhuang5332 жыл бұрын
Nice vieos.
@yashrajjaiswal99412 жыл бұрын
🙏
@devindickerson96992 жыл бұрын
looking for anyone who know how to add event listeners to the html in each view
@_.sunnyraj._4 жыл бұрын
Second !!!!!
@zakur0hako2 жыл бұрын
i guess this is not for beginners. regexp part is confusing as hell
3 жыл бұрын
Sorry but second part is really complicated
@ashiqurrahmantahmid96343 жыл бұрын
All I hear is right here xD
@remco_smits3 жыл бұрын
`no framework` NODE JS IS A FRAMEWORK DOGGGG
@christianf77403 жыл бұрын
"new match.route.view" - this is why I prefer typescript. So confusing.
@tangkasr2132 Жыл бұрын
Hi and thanks for the great vid! I learned a lot in this tutorial :) But I have one problem with my code. If i try to access to the /posts/:id route in my browser search bar I get a MIME Type error. If I am accessing it via link tag in my html it works totally fine. What could be a potential mistake I did?
@aguileraq4 жыл бұрын
Great video. I really hope you can complement this SPA with firebase auth, it will be great. Thanks!!