Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@angular/platform-server
Advanced tools
@angular/platform-server is an Angular package that enables server-side rendering (SSR) for Angular applications. It allows you to render Angular applications on the server, which can improve performance, SEO, and user experience by delivering fully rendered pages to the client.
Server-Side Rendering (SSR)
This feature allows you to render an Angular application on the server. The `renderModule` function takes an Angular module and renders it to a string, which can then be sent to the client.
const { renderModule } = require('@angular/platform-server');
const { AppServerModule } = require('./src/main.server');
renderModule(AppServerModule, {
document: '<app-root></app-root>',
url: '/'
}).then(html => {
console.log(html);
});
Preboot
Preboot is a library that works with Angular Universal to record and playback user events while the client-side app is loading. This code sample demonstrates how to set up a global window and document object using the 'domino' library to enable Preboot.
const { renderModule } = require('@angular/platform-server');
const { AppServerModule } = require('./src/main.server');
const { createWindow } = require('domino');
const win = createWindow('<html><head></head><body><app-root></app-root></body></html>');
global['window'] = win;
global['document'] = win.document;
global['navigator'] = win.navigator;
renderModule(AppServerModule, {
document: win.document,
url: '/'
}).then(html => {
console.log(html);
});
Transfer State
Transfer State allows you to transfer state from the server to the client, reducing the need for duplicate HTTP requests. This code sample shows how to import and use the ServerTransferStateModule in your server-side module.
import { NgModule } from '@angular/core';
import { ServerModule, ServerTransferStateModule } from '@angular/platform-server';
import { AppComponent } from './app.component';
import { AppModule } from './app.module';
@NgModule({
imports: [
AppModule,
ServerModule,
ServerTransferStateModule
],
bootstrap: [AppComponent],
})
export class AppServerModule {}
Next.js is a React framework that enables server-side rendering and static site generation. It provides a similar SSR functionality to @angular/platform-server but is designed for React applications. It also includes features like API routes, automatic code splitting, and more.
Nuxt.js is a framework for Vue.js that enables server-side rendering and static site generation. It offers similar SSR capabilities to @angular/platform-server but is tailored for Vue.js applications. Nuxt.js also provides features like automatic routing, Vuex store integration, and more.
Sapper is a framework for Svelte that provides server-side rendering and other advanced features. It offers similar SSR functionality to @angular/platform-server but is designed for Svelte applications. Sapper also includes features like file-based routing and prefetching.
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT
19.0.0-rc.1 (2024-11-06)
| Commit | Type | Description | | -- | -- | -- | | b25121ee4a | fix | avoid having to duplicate core environment (#58444) |
| Commit | Type | Description | | -- | -- | -- | | d4d76ead80 | fix | do not fail fatal when references to non-existent module are discovered (#58515) | | 22cd6869ef | fix | make the unused imports diagnostic easier to read (#58468) |
| Commit | Type | Description | | -- | -- | -- | | 8ae84be3df | fix | avoid slow stringification when checking for duplicates in dev mode (#58521) | | 6e0af6dbbb | fix | resolve forward-referenced host directives during directive matching (#58492) |
| Commit | Type | Description | | -- | -- | -- | | c5e676bb87 | fix | flip the default standalone flag in route-lazy-loading migration (#58474) | | e85ac5c7cb | fix | properly bundle shared compiler code into migrations (#58515) |
| Commit | Type | Description | | -- | -- | -- | | c36a1c023b | fix | correctly add external stylesheets to ShadowDOM components (#58482) |
<!-- CHANGELOG SPLIT MARKER --><a name="18.2.11"></a>
FAQs
Angular - library for using Angular in Node.js
The npm package @angular/platform-server receives a total of 255,547 weekly downloads. As such, @angular/platform-server popularity was classified as popular.
We found that @angular/platform-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.