RepositorywillbeseparatedintoserverandclientdirectoryforNestJSbackendandAngularfrontendresepctively.
ServerrepositoryClientrepositoryDockersupportHookupServerandClientServer-side(NestJS)ThisrepositoryhousestheProject'sbackendwrittenusingNestJS
NSwag:NswagallowsustogenerateAPICallstoourBackendonourFrontendinformsofFunctions.TheabstractionofHttpClientModuletakesplaceinthegeneratedfile.Steps:cd./server&npmitoinstallalldependenciesforServersideHaveaninstanceofMongoDBrunning(mongod).IfyouuseanIDElikeWebStorm,Ihaveascriptcalled:mongo:localthatisgoingtorunmongodsubsequentlysoyoucansetupaCompoundRunConfigurationwithstart:devandmongo:localtostarttheBackendwithease.npmrunstart:devtostarttheserverNote:Ifthere'sissueconnectingtolocalMongoDBandyoumakesurethatyoualreadyhavemongodrunning,gotoconfig/default.tsandcheckiftheMONGO_URIiscorrect.Client-side(Angular)ThisrepositoryhousestheProject'sfrontendwrittenusingAngular6
AntDesign:ThecomponentsdesignisbyAntDesign(https://ng.ant.design/docs/introduce/en).IreallylikethesubtlelooksofAntDesign.Steps:npmitoinstallallthedependenciesthenjuststarttheapplicationwithngserveNote:Mightbeworthittotakealookatproxy.conf.jsonandhowIsetuptheCLItousetheproxyfilewhenservingsothatwecancallourbackendonlocalhost:3000.Thisisso-calledCrossDomainsRequestandourbackenddoesnothaveCORSsetup.Proxywillhelpusmakingtherequestsfrom4200to3000.DockerDockerissupported.
Branch:dockerSteps:Justclonetherepository,checkoutdockerbranchthenfromrootdirectory,rundocker-composeupandDockerwilltakeover.Note:AngularapplicationwillbeservedbyNGINXonlocalhost;Nestapplicationwillberunningonlocalhost:3000;cAdvisorwhichmonitorsourcontainerswillberunningonlocalhost:8080.Again,it'sworthwhiletoexploretheDockerfileinbothclientandserverdirectory;alsonginx.confanddocker-compose.ymltogetthegistofhowDockerandDockerComposework.P.S:PullRequests,Contributionsaremostdefinitelywelcomed:)
评论