How to keep the Ionic app session alive always


I am new to Ionic and building a hybrid application not targeted to any specific platform.
I am using putty to run the application using the command “Ionic serve”. When I close the putty, the application doesn’t work.
Currently I am using Linux server to run the application. Please help

Ionic Serve (As far as I’m aware) is used just for testing. I don’t think it would be wise to try and deploy an app that is used over the web that way since it houses everything inside your app. So when I’m developing I have multiple terminal/putty windows going at the same time. 1 for Ionic Serve, 1 for building to different platforms, 1 for other things (maybe an SSH window for example).

The reason it doesn’t work when you close the window also is because it actually runs a web server instance that your app is hosted on. So mine is hosted on localhost:3000, so if the server is not running anymore, your web browser won’t be able to locate that path.

I hope this gave you some details in the right direction.

So, is there a way to keep the server running forever after closing the Putty window? or is there any alternate solution for this.

You mentioned you are on a linux environment, I haven’t actually tried it with Ionic Serve yet but there is a node module named Forever. Forever can create a daemon of the node script you want to run and then keep it alive even if it crashes. This is an excellent article on how Forever works (it’s relatively simple)

Let me know how that works! If it doesn’t cause conflicts then I’d be interesting in maybe integrating it into my work flow.

Hi, I used a different solution, installed a tomcat server as a wrapper , this fixed my problem. Thank you for helping me out.

1 Like

any updates? did you found the solution?

I did by using a simple express builtin server, here is the tuto:

How to deploy ionic app on tomcat server can anyone suggest me the steps to follow !