fastify-angular-universal
Angular server-side rendering support for Fastify using Angular Universal.
Install
npm install --save fastify-angular-universal
Usage
Add it to you project with register
and pass the required options.
Follow the tutorial on how to perform SSR in Angular with Angular CLI here ONLY UNTIL step 3.
For the steps 4 and onwards use the following server.ts
or check out the server.ts
in the test-app directory
// These are important and needed before anything else;; ;; ;; // * NOTE :: leave this as require() since this file is built Dynamically from webpack;; // Faster server renders w/ Prod mode (dev mode never needed)enableProdMode; ;; // Our index.html we'll use as our template; ; app.registerrequire'fastify-static', ; // register the fastify-angular-universal to your application together with the required optionsapp.registerrequire'fastify-angular-universal', ; // Declare a routeapp.get'/*', ; // Run the server!app.listenPORT, ;
Options
This plugin allow you to specify options:
serverModule
to specify the NgModuleFactory to be used in rendering an Angular app in the serverdocument
to specify the template where the Angular app will be renderedextraProviders
to specify additional providers to be used by the Angular app. (optional)
License
MIT.