Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@nestjs/azure-func-http
Advanced tools
Nest - modern, fast, powerful node.js web framework (@azure-func-http)
A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
Angular Universal module for Nest.
Using the Angular CLI:
$ ng add @nestjs/ng-universal
Or manually:
$ npm i --save @nestjs/ng-universal
See full example here.
Simply import AngularUniversalModule
in your Nest application.
import { Module } from '@nestjs/common';
import { join } from 'path';
import { AngularUniversalModule } from '@nestjs/ng-universal';
@Module({
imports: [
AngularUniversalModule.forRoot({
viewsPath: join(process.cwd(), 'dist/browser'),
bundle: require('./../dist/server/main.js'),
}),
],
})
export class ApplicationModule {}
The forRoot()
method takes an options object with a few useful properties.
Property | Type | Description |
---|---|---|
viewsPath | string | The directory where the module should look for client bundle (Angular app) |
bundle | Object | Bundle file (webpack output with AppServerModuleNgFactory ) |
templatePath | string? | Path to index file (default: {viewsPaths}/index.html ) |
rootStaticPath | string? | Static files root directory (default: *.* ) |
renderPath | string? | Path to render Angular app (default: * ) |
extraProviders | StaticProvider[]? | The platform level providers for the current render request |
This tool uses @nguniversal/express-engine
and will properly provide access to the Express Request and Response objects in you Angular components.
This is useful for things like setting the response code to 404 when your Angular router can't find a page (i.e. path: '**'
in routing):
import { Response } from 'express';
import { Component, Inject, Optional, PLATFORM_ID } from '@angular/core';
import { isPlatformServer } from '@angular/common';
import { RESPONSE } from '@nguniversal/express-engine/tokens';
@Component({
selector: 'my-not-found',
templateUrl: './not-found.component.html',
styleUrls: ['./not-found.component.scss'],
})
export class NotFoundComponent {
constructor(
@Inject(PLATFORM_ID)
private readonly platformId: any,
@Optional()
@Inject(RESPONSE)
res: Response,
) {
// `res` is the express response, only available on the server
if (isPlatformServer(this.platformId)) {
res.status(404);
}
}
}
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Nest is MIT licensed.
FAQs
Nest - modern, fast, powerful node.js web framework (@azure-func-http)
The npm package @nestjs/azure-func-http receives a total of 994 weekly downloads. As such, @nestjs/azure-func-http popularity was classified as not popular.
We found that @nestjs/azure-func-http demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.