fastify-cli icon indicating copy to clipboard operation
fastify-cli copied to clipboard

How to run a fastify server in production

Open zoulou00 opened this issue 1 year ago • 2 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the issue has not already been raised

Issue

Hi,

I have scaffolded my project with : fastify generate myproject --esm --lang=ts In my package.json, I have: start": "npm run build:ts && fastify start -l info dist/app.js", "build:ts": "tsc",

To run my sever in a production environnement do I need to run npm run start ? So every time I start the server it will rebuild the ts files ?

Thanks

zoulou00 avatar Feb 06 '24 14:02 zoulou00

That seems a bit extreme. I would change that script and split the build and start steps.

mcollina avatar Feb 08 '24 13:02 mcollina

Hi I created a PR, please take a look https://github.com/fastify/fastify-cli/pull/707

zoulou00 avatar Feb 16 '24 09:02 zoulou00