AndwewanttouseDi e n v andwealsowanttouseNodeMonNowDottieenvyisgoingtoallowustopollingenvironmentvariablesfrom a dottyand V fileandknowedMontewillallowustorefreshourservereverytimewemakechanges.
Thenextthingweneedtodoisactuallyconnectorhave a dietdatabasesoultypeinMongooseConnect, andwewanttoputinherethestringwhichisourdatabaseconnectionandourcase.
Thisisgoingtobemongo, D B colon, backslash, backslash.
Wecouldjustsay D b dotonandwhatwewanttodoisonerror.
Wewanttologoutthatthere's anair, sowe'lljustsayherethisisgoingtotake a functionwithanairandwecancomeinhereandsayconsoledotthereandwecanpassitthatairthis'lljustallowustoseeifthere's a problemconnectingtoourdatabase.
Also, whatwewanttodoisitOnceweconnectsowell, saydata D b dotonce, whichmeansit's onlyoneruns.
Butonethingthatyou'llnoticeimmediatelyisthatwehaveourmongo D B databasestringinsideofourapplication, andwhenwedeployourapplication, we'regoingtowanttousesomethingthat's notourlocalhost, soweneedtopullthisoutintoanenvironmentvariable.
Solet's removethisrighthere.
GointoourdotndWecouldjustcreate a variable, whichwe'regoingtocalldatabaseyou, Earl.
Butwehavenoroutesactuallyconfiguredyet, sinceitisgoingtobe a rest, Phillipe, I we'regoingtouserestfulinpoints.
Andifyoudon't alreadyhave a stronggraspofwhatrestisandwhatrestwillendpointsare I have a reallyshortvideogoingoverarrestindepth, whichyoucancheckoutinthecardsandthedescriptionlikebelow.
Sonowlet's startcreatingourdifferentroutes.
We'regoingtowantsomeroutesforgettingallsubscribersweregonnawant a routeforgettingone.
We'realsogonnawant a routeforcreatingone.
We'regonnawant a routeforupdatingthesingleonehopesupdatingone.
Andnormally, totestthese, youmaygointothebrowserandopenitup, butyoucan't reallytestarrest a guyverywellin a browserbecauseyouhavenothingtointeractwith.