Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to switch to Fastify #3

Closed
bohushvitali opened this issue Oct 3, 2018 · 9 comments
Closed

Add option to switch to Fastify #3

bohushvitali opened this issue Oct 3, 2018 · 9 comments

Comments

@bohushvitali
Copy link

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Expected behavior

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Better cold-start times when running in serverless environment

Environment


Nest version: X.Y.Z

 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

@neilime
Copy link

neilime commented Oct 31, 2018

I've tried to use fastify as explained in https://docs.nestjs.com/techniques/performance, wihout success :

Always get an error "[PackageLoader] The "fastify" package is missing. Please, make sure to install this library ($ npm install fastify) to take advantage of FastifyAdapter."

Even if I manually load fastify package in main.ts. Examples:

  • const fastify = require('fastify');
  • import fastify from 'fastify';
  • ...

Maybe it will be usefull to be able to pass the fastify instance to the adapter :

const fastify = require('fastify');

enableProdMode();

async function bootstrap() {
  const app = await NestFactory.create(ApplicationModule, new FastifyAdapter({
    instance: fastify
  }));
  app.enableCors({
    methods: 'GET',
    maxAge: 3600,
  });
  await app.listen(4000);
}
bootstrap().catch(err => console.error(err));

@darita92
Copy link

Anyone has been able to do this, I am still getting this error.

@MichiNetlight
Copy link

Will fastify support be an option in the future?

@Sikora00
Copy link

@kamilmysliwiec I can push it further and try to create a pull request after the answer in angular/universal#1871

@kamilmysliwiec
Copy link
Member

@Sikora00 sounds great!

@Sikora00
Copy link

Sikora00 commented Jan 13, 2021

@kamilmysliwiec things get complicated angular/universal#1892
It looks like the angular universal won't support fastify by themselves. One plus is that there is already a working solution in this pull request. The question is if you are good with using that solution, where this should be stored (what organization on github and who will maintain it).
For now, I think there is only an option to create a new (@nestjs|trilon)/fastify-engine or I can declare that we can create and maintain it with @valueadd-poland

@kamilmysliwiec
Copy link
Member

I can declare that we can create and maintain it with @valueadd-poland

If you have some time, that would be great! Feel free to fork this repository (+ ping users here once it's available - if you want). Since Angular doesn't plan to publish this under the official organization account, we won't be doing this either.

@invaderb
Copy link

invaderb commented Aug 9, 2022

@Sikora00
Have you started this process yet? ng-universal has opened the common engine api to be consumed as needed

@Sikora00
Copy link

@invaderb no I haven't. I don't think I could handle maintenance by myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants