Reload server.ts
Closed this issue · 3 comments
malikiz commented
Hi, I can't figure out how to reload my application when editing server.ts
, how can I achieve this?
In my case I want to edit the example:
app.get("/message", (_, res) => {
res.send("Hello from express!")
});
When I edit server.ts
nothing happens. F5
key in browser does not help me. For this I have to restart the application manually
szymmis commented
malikiz commented
Thanks for the hint, it really works. Just in case, I'll write how to implement this on node 20 and typescript 5 versions:
in package.json
:
{
"type": "module",
"scripts": {
"dev": "nodemon --exec \"node --loader ts-node/esm\" ./src/server/server.ts -w ./src/server"
}
}
in tsconfig.json
:
{
"ts-node": {
"transpileOnly": true,
}
}
malikiz commented
I'm closing this issue