From 4ef62b6fcf9763e2c115ea1171cccd4a39b7c1fa Mon Sep 17 00:00:00 2001 From: Nils Dittberner Date: Tue, 5 Dec 2017 09:08:40 +0100 Subject: [PATCH] 25-350 Configuring server side rendering --- .angular-cli.json | 24 ++++++++++++++++++++++++ dist-server/favicon.ico | Bin 0 -> 5430 bytes dist-server/main.bundle.js | 1 + dist-server/styles.bundle.css | 0 package-lock.json | 23 +++++++++++++++++++++++ package.json | 2 ++ src/app/app.module.ts | 2 +- src/app/app.server.module.ts | 14 ++++++++++++++ src/main.server.ts | 4 ++++ src/tsconfig.server.json | 17 +++++++++++++++++ 10 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 dist-server/favicon.ico create mode 100644 dist-server/main.bundle.js create mode 100644 dist-server/styles.bundle.css create mode 100644 src/app/app.server.module.ts create mode 100644 src/main.server.ts create mode 100644 src/tsconfig.server.json diff --git a/.angular-cli.json b/.angular-cli.json index ebd0e2b..5588e40 100644 --- a/.angular-cli.json +++ b/.angular-cli.json @@ -28,6 +28,30 @@ "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } + }, + { + "name": "universal", + "platform": "server", + "root": "src", + "outDir": "dist-server", + "assets": [ + "assets", + "favicon.ico" + ], + "index": "index.html", + "main": "main.server.ts", + "tsconfig": "tsconfig.server.json", + "prefix": "app", + "styles": [ + "../node_modules/bootstrap/dist/css/bootstrap.min.css", + "styles.css" + ], + "scripts": [], + "environmentSource": "environments/environment.ts", + "environments": { + "dev": "environments/environment.ts", + "prod": "environments/environment.prod.ts" + } } ], "e2e": { diff --git a/dist-server/favicon.ico b/dist-server/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8081c7ceaf2be08bf59010158c586170d9d2d517 GIT binary patch literal 5430 zcmc(je{54#6vvCoAI3i*G5%$U7!sA3wtMZ$fH6V9C`=eXGJb@R1%(I_{vnZtpD{6n z5Pl{DmxzBDbrB>}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975; z@4kD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%?vmxjS- zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn= z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky humW;*g7R+&|Ledvc--1?(n.editedItem=l.editedIngredient,n.editMode=!0,n.shoppingListForm.setValue({name:n.editedItem.name,amount:n.editedItem.amount})):n.editMode=!1})},n.prototype.onSubmit=function(n){var l=n.value,e=new t.Ingredient(l.name,l.amount);this.store.dispatch(this.editMode?new u.UpdateIngredient(e):new u.AddIngredient(e)),this.editMode=!1,n.reset()},n.prototype.onClear=function(){this.shoppingListForm.reset(),this.editMode=!1},n.prototype.onDelete=function(){this.store.dispatch(new u.DeleteIngredient),this.onClear()},n.prototype.ngOnDestroy=function(){this.store.dispatch(new u.StopEdit),this.subscription.unsubscribe()},n}()},GJF7:function(n,l,e){"use strict";l.styles=[""]},GflJ:function(n,l){n.exports=require("@ngrx/effects")},GrDH:function(n,l,e){"use strict";var t=e("OQ0P"),u=e("8IlT"),o=e("Xt3F"),i=e("ktxa"),r=e("Oq3J"),d=e("i/IN"),s=e("yv0u"),a=e("02xY"),c=e("q6lm"),p=e("AZ97"),m=e("A7Ap"),g=e("OKzv"),f=e("T2Au"),v=e("xzcb"),C=e("AYCW"),R=e("GflJ"),h=e("Ir0Z"),S=e("DI2O"),E=e("WXLR"),_=e("ZA/m"),y=e("WsQm");l.RecipesModuleNgFactory=t.\u0275cmf(u.RecipesModule,[],function(n){return t.\u0275mod([t.\u0275mpd(512,t.ComponentFactoryResolver,t.\u0275CodegenComponentFactoryResolver,[[8,[o.RecipesComponentNgFactory,i.RecipeStartComponentNgFactory,r.RecipeEditComponentNgFactory,d.RecipeDetailComponentNgFactory]],[3,t.ComponentFactoryResolver],t.NgModuleRef]),t.\u0275mpd(4608,s.NgLocalization,s.NgLocaleLocalization,[t.LOCALE_ID,[2,s.\u0275a]]),t.\u0275mpd(4608,a.FormBuilder,a.FormBuilder,[]),t.\u0275mpd(4608,a.\u0275i,a.\u0275i,[]),t.\u0275mpd(4608,c.AuthGuard,c.AuthGuard,[p.Store]),t.\u0275mpd(512,s.CommonModule,s.CommonModule,[]),t.\u0275mpd(512,a.\u0275ba,a.\u0275ba,[]),t.\u0275mpd(512,a.ReactiveFormsModule,a.ReactiveFormsModule,[]),t.\u0275mpd(512,m.RouterModule,m.RouterModule,[[2,m.\u0275a],[2,m.Router]]),t.\u0275mpd(512,g.RecipesRoutingModule,g.RecipesRoutingModule,[]),t.\u0275mpd(512,f.SharedModule,f.SharedModule,[]),t.\u0275mpd(1024,p.STORE_FEATURES,function(){return[{key:"recipes",reducerFactory:p.combineReducers,metaReducers:[],initialState:void 0}]},[]),t.\u0275mpd(1024,p._FEATURE_REDUCERS,function(){return[v.recipeReducer]},[]),t.\u0275mpd(1024,p._FEATURE_REDUCERS_TOKEN,function(n){return[n]},[p._FEATURE_REDUCERS]),t.\u0275mpd(1024,p.FEATURE_REDUCERS,function(n,l,e){return[p._createFeatureReducers(n,l,e)]},[t.Injector,p._FEATURE_REDUCERS,p._FEATURE_REDUCERS_TOKEN]),t.\u0275mpd(131584,p.StoreFeatureModule,p.StoreFeatureModule,[p.STORE_FEATURES,p.FEATURE_REDUCERS,p.ReducerManager]),t.\u0275mpd(512,C.RecipeEffects,C.RecipeEffects,[R.Actions,h.HttpClient,p.Store]),t.\u0275mpd(1024,R.\u0275f,function(n){return[R.\u0275a(n)]},[C.RecipeEffects]),t.\u0275mpd(512,R.\u0275d,R.\u0275d,[R.\u0275c,R.\u0275f,[2,p.StoreModule]]),t.\u0275mpd(512,u.RecipesModule,u.RecipesModule,[]),t.\u0275mpd(1024,m.ROUTES,function(){return[[{path:"",component:S.RecipesComponent,children:[{path:"",component:E.RecipeStartComponent},{path:"new",component:_.RecipeEditComponent,canActivate:[c.AuthGuard]},{path:":id",component:y.RecipeDetailComponent},{path:":id/edit",component:_.RecipeEditComponent,canActivate:[c.AuthGuard]}]}]]},[])])})},"H6/C":function(n,l,e){"use strict";var t=this&&this.__assign||Object.assign||function(n){for(var l,e=1,t=arguments.length;e