fastify / fastify-cli

Run a Fastify application with one command!
MIT License
644 stars 160 forks source link

How to run a fastify server in production #705

Open zoulou00 opened 5 months ago

zoulou00 commented 5 months ago

Prerequisites

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

mcollina commented 5 months ago

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

zoulou00 commented 5 months ago

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