RSS Amplifier

Sekrab’s Parts · Jan 23, 2024

Replacing Angular Universal with SSR version 17.0

0
Sign in to vote or save

Sekrab · Sekrab’s Parts

Angular has adopted Universal and made it a kid of its own! Today I will rewrite some old code we used to isolated express server as we documented before with the most extreme version of serving the same build for multiple languages from Express, we are also using a standalone version as we covered recently.

Let’s dig.

Find GitHub branch of cricketere with server implementation

We need to first install SSR package and remove any reference to Angular Universal. (Assuming we have upgraded to Angular 17.0)

npm install @angular/ssr

npm uninstall @nguniversal/common @nguniversal/express-engine @nguniversal/builders

Using ng add @angular/ssr rewrites the server.ts and it claims to add a config file somewhere. Yeah, nope!

In our last attempt for a skimmed down, standalone server.ts, it looked like this

// the last server.ts
import { ngExpressEngine } from '@nguniversal/express-engine';
import 'zone.js/dist/zone-node';
// ...
const _app = () => bootstrapApplication(AppComponent, {
  providers: [
    importProvidersFrom(ServerModule),
    // providers: providers array...
  ],
});
// export the bare minimum, let nodejs take care of everything else
export const AppEngine = ngExpressEngine({
  bootstrap: _app
});

Now the ngExpressEngine is gone. Here are three sources to dig into to see if we can create our own skimmed down engine.

Continue reading on Sekrab Garage

No posts

Read the original on sekrab.substack.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.