Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nestjs/azure-func-http

Package Overview
Dependencies
Maintainers
4
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs/azure-func-http - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

index.d.ts

@@ -1,1 +0,1 @@

export * from "./dist";
export * from './dist';
{
"name": "@nestjs/azure-func-http",
"version": "0.1.1",
"version": "0.1.2",
"description": "Nest - modern, fast, powerful node.js web framework (@azure-func-http)",

@@ -5,0 +5,0 @@ "author": "Kamil Mysliwiec",

@@ -29,88 +29,12 @@ <p align="center">

Angular [Universal](https://github.com/angular/universal) module for [Nest](https://github.com/nestjs/nest).
[Azure Functions](https://code.visualstudio.com/tutorials/functions-extension/getting-started) HTTP module for [Nest](https://github.com/nestjs/nest).
## Installation
Using the Angular CLI:
Using the Nest CLI:
```bash
$ ng add @nestjs/ng-universal
$ nest add @nestjs/azure-func-http
```
Or manually:
```bash
$ npm i --save @nestjs/ng-universal
```
## Example
See full example [here](https://github.com/kamilmysliwiec/universal-nest).
## Usage
Simply import `AngularUniversalModule` in your Nest application.
```typescript
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 {}
```
## API Spec
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 |
## Request and Response Providers
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):
```ts
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);
}
}
}
```
## Support

@@ -117,0 +41,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc