You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run and manage all my apps using Plesk on my dedicated server. I use the Nodejs extension.
I'm trying to push myself to use nitro instead of express but I'm experiencing some difficulties on how to deploy. If you are like me, let's share our experience in this discussion and hopefully we will have a stable outcome that can also be published on the docs.
Let me start by showing you quickly how I run my express apps on plesk:
I use git extension or sometimes ftp my whole project to my domain directory in this case it's a subdomain (api.example.com) and use this setting on node extension:
I click npm install then click run script and I type start which is equal to npm run start (node app.js) based on package.json
Then I move all the folders and files from /server to my plesk domain directory and I try to the same installing and running as express way that I showed you above 👆 the only change was in application startup file name since it's index.mjs
In this step, I'm having a hard time understanding how nitro works:
My isssue 1: package.json doesn't have any scripts such as: start ...
I've tried to add "scripts": { "start" : "node index.mjs" } manually by editing package.json , it does have effect but the app is not working and my requests are returning status 500
Any clue what i'm missing here?
Issue 2: Port is always on default 3000 on production, How do we set a port for production?
digging in the docs, I've found a way to set the port by extending node-server preset follow this example
Feel free to share your experience, ideas and thoughts.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi Everyone!
I run and manage all my apps using Plesk on my dedicated server. I use the Nodejs extension.
I'm trying to push myself to use nitro instead of express but I'm experiencing some difficulties on how to deploy. If you are like me, let's share our experience in this discussion and hopefully we will have a stable outcome that can also be published on the docs.
Let me start by showing you quickly how I run my express apps on plesk:
I'm using this starter express template
start
which is equal tonpm run start
(node app.js
) based onpackage.json
The app now runs on port 4242 as specified in
app.js
and.env
Now Lets see how to do the same with Nitro
I'm using this starter nitro template
I set
PORT = 4242
on.env
, Everything works as expected on dev and I runnpm run build
with the default node server presetI get:
Then I move all the folders and files from /server to my plesk domain directory and I try to the same installing and running as express way that I showed you above 👆 the only change was in application startup file name since it's
index.mjs
In this step, I'm having a hard time understanding how nitro works:
My isssue 1:
package.json
doesn't have any scripts such as:start
...I've tried to add
"scripts": { "start" : "node index.mjs" }
manually by editingpackage.json
, it does have effect but the app is not working and my requests are returning status 500Any clue what i'm missing here?
Issue 2: Port is always on default 3000 on production, How do we set a port for production?
digging in the docs, I've found a way to set the port by extending node-server preset follow this example
Feel free to share your experience, ideas and thoughts.
Beta Was this translation helpful? Give feedback.
All reactions