Welcometo a veryspecialcoatingtradeatthisodewith a slightlydifferentlookingcodingtrainlogoFleece, um, likeplantsandflowersandthingswillstartgrowingfromhere.
I'm kindofvampingheretoseeifpeoplechat.
Starttosayhithatthesoundisworkingoneverything, because I, uh, straight I'm ontimetoday.
Andthereasonisbecauseit's notactuallymewhowillbepresentingtoyouveryexcitedtointroducetoyou a guestCJfromthecodinggarden.
Sotheplanfortodayistobuild a fullstackapplication, andtheideais I'm goingtobuild a verybasicTwitterclonetodemonstrateallthepartsandpiecesofthefullstack.
SointhisdirectoryhereOh, andbefore I forget, I did.
Allofthisisongethubrightnow.
It's just a checklist.
Butas I code, I'llpushituptogetHub.
Oneofthemodscanpotentiallysharethislink.
I putitintheslack.
Youcanshareitinthechat.
Peoplewanttoclickonit, butthefirstthingiswillcreate a clientfolderandinsideofthatclientfolderhereinthe S codewillcreate a newfileandcallitindexdotHTMOh, orcreate a basicHTMLdocument.
ThetitlewillbeAh, twit.
Uh, ourmeatmeOh, twitterforcatsAndlet's putlike a littlecatemoji.
Therewego.
Fornow, I'm gonnaget a littlebitofthis, Lincoln, Thescripthereinthebodywilladd a header.
Sojusttomakesurewe'reclearastowherewearewhenwe'reworkingonthem, I'm gonnacallthisoneclient a Js, and I'm gonnagoaheadbefore I forgetWilladd a scriptatthebottomherethatwillbringinourclient s.
Sofirstthing I'lldoisget a referencetotheformbyusing a documentdocumentdotqueryselectorandthenwithqueryselector, youcanpassinanyvalidCSSselectortochoosesomeelementonthepage.
Sointhiscase, I wanttoselectthisform.
So a validCSSselectorforthatisjust a passiveformandthatwillgivemetheform.
Yes, Andbydoingthisnowintheterminal, I couldjustdoin P m startandthatwillstartupmyserveronPort 5000.
Sowetake a lookatitrightnow.
It's nothing.
Sowehave a blinkbackinapplication.
Itdoesn't haveanyroutes.
Sowhen I trytorequest, itjustsays, cannotgetthat.
Andsobasically, we'regoingtostartdefiningwhathappenswhen a clientmakesrequeststothisserver.
Sowe'llgetourchecklist.
Wecreatedtheserverfolder.
Weinitializedit.
Weinstalldependencies.
Wehaveourbasicsetup.
Now I'm goingtoadd a listenerforwhen a getrequestcomesinontheslashroute.
So, as I mentionedearlier, whenyoujustputsomethinginyourbrowserandhitenter, thatis a gitrequest.
Andbydefault, it's making a getrequesttotheslashwrapped.
Sowhat I'm gonnadoonmyservers, sayhisriverwhenyouget a getrequestontheSLASHwroteRunthisfunctionandwehavetwovariablesinhere, typicallytheirabbreviatedwreckandrez, which I liketodo, buttheyreallystandforrequestandresponse.
So I'm curiousastowhyorifitmatters, you'restillusingtheliveserverforthestaticfilesistheideathatyouwouldeventuallymovethestaticfilesalsolike, Whynothavethedynamicserveralsohostthosestaticfiles?
Yes, sothereare a lotof a lotofwaystodoit.
Youcoulddothat, but I amactuallyattheend.
I'llshowhowweputthisontheInterneton.
Theideawithkeepingtheseon a separateserveristhatwecanbenefitfromthingslike a CDinlike, ConstantDeliveryNetwork.
There's thishandytoolcallednodeMom, whichwillautomaticallyrefresheverytime I changetheserverandwe'llinstallthatandbasicallyallrunitinanytime I changedfilesontheserver, itautomaticallyrestartandweshouldseethosechangeswhenwemake a requesttoit.
Sonodaemonisinstalled.
I'm gonnaadd a newscriptinmypackage.
Jason's goingtocreate a Debscript.
No, monand, um, justdothesamething.
Sotellnodaemontorunagainstthatfile.
Andnowif I doin P m.
Run, Dev, thatstartsupnodemonitor.
Anytime I makechanges, itshouldrestarttheserver.
Sothisloads.
Butif I gobacktomyservercodeandat a newemojiliketheregularcatand I againmaketherequestandsoyoumightbesayingthis, but I'm pressingcommandaresomerefreshingthepagewhichismakinganothergetrequesttotheserveronslashandthen I seethelatestresult.
Cool.
Sowehave a basicserversetupthat's respondingtoincomingrequestsbefore I moveontothisnextthing.
Sothewaythisworksis I canbringinthecoresmoduleandthendowhat's calledusingit.
So I'llsayappthatusecoresandthisactuallyaddscoresas a middlewhereSonowanyincomingrequeststomyserverisgonnapassthroughthismiddleware, andit's gonnaautomaticallyaddthosecoresheaderstoit.
And I waslike I hadnoideawhattheyweretalkingabout.
Yes.
Oh, joyis a librarythatcomesoutofthehappyteam.
They'resohappyisanotherframeworkverysimilartoexpress, butyoujustdothings a littlebitdifferently.
Butjoyisreallycoollibrary, becauseyoucando, likeobject, scheme a validationand, likemakesuresomethingis a string, andit's oftenAmericanhas, like a verynicewayofdefiningit.
I actuallyfoundonecalledIt's called.
Yep, whichwasbasedonJoyisveryyes, there.
Therearelotsofthem.
Initiallywhenyou'regettingstarted, I liketojustshowthistoshowlikewhat's happening, Butabsolutelyifyouifyouhaveanobjectthathas, like, 10 properties, youprobablywanttousesomelibrarylikethis.
Oh, no.
Did I justcloseCrow.
I think I didwait, did I Well, lookallthose 8000 andthenlocalhost 80.
Andtheneverytimesomeonesubmits, um, youwillputanobjectinherethathas, like, a name, andithassomecontent, andthenMongowillautomaticallyassignitsomeunique I D.