question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove the use of this.app.useGlobalFilters, Warning RendererService is a singleton

See original GitHub issue

Hello, thank you for this lib,

Actually, each route is binded to the renderer, It would be interesting to to be able to configure the url to handle via next and others via nest. Trying to make an ajax request from browser to server ends in a “Not implemented” response.

Tell me if I am wrong, the renderer service is a singleton as the nest js module specification says. When an incoming request happens, you store the request and the response on the singleton this.service.next(req, res). But this request and response might be replaced by an other request…

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kyle-mccarthycommented, Feb 18, 2019

@Rmannn I released a new version that exposes the render method on the response object. This should allow for you to do what you were wanting without needing to modify or pass a custom filter. You can see #6 for the details!

1reaction
kyle-mccarthycommented, Jan 17, 2019

Thanks for providing me with this extra information. I have been thinking about this, and while I can provide a way for you to pass in your own filter implementation, what if I exposed a render method that you could call directly? I was thinking something along the lines of this…

@Controller('page')
export class PageController {

  constructor(private readonly renderer: RendererService) {}

  index(@Req() req, @Res() res) {
    if (...) {
      // return some json
    }
    return this.renderer.render(req, res, 'YourView');
  }
}

The render method on the RenderService could then handle applying a prefix if you have one set, and would optionally accept a fourth argument for the initial props.

I was thinking this may be easier for you to maintain, but if you would prefer a custom filter option I could do that as well.

Also addressing your second point from the initial post, I have verified this is conceptually possible and will be pushing a new version today.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception filters | NestJS - A progressive Node.js framework
Warning The useGlobalFilters() method does not set up filters for gateways or hybrid applications. Global-scoped filters are used across the whole application, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found