Reputation: 58662
I am on a Mac OS X.
Right now, I have almost 10 Laravel/LAMP projects locally, that I ran using vhost configured with Apache. The awesome part about them is even when I restart my Mac or move between networks, or even close the terminal app/tab of my projects, the Apache is still running, all my local sites will still be accessible.
Now, I am looking to do the same things with my MEAN apps. How would one configure something like that ?
Let's say I have 3 MEAN apps.
Example
App1
FE running on port : http://localhost:4201
BE running on port : http://localhost:3001
App2
FE running on port : http://localhost:4202
BE running on port : http://localhost:3002
App3
FE running on port : http://localhost:4203
BE running on port : http://localhost:3003
I'm opening for anything suggestions at this moment.
Can we configure the npm to start in the background ?
Upvotes: 2
Views: 2296
Reputation: 303
You can use macOS's launchd
to run services in the background. There are a couple good GUI apps that make it easier to create launch services:
There's also launched.zerowidth.com, an interactive online tool for creating the .plist
files that launchd
uses.
launchd.info is also a good resource if you want to set them up manually. Apple's documentation is available too.
If you are having problems with commands not working, I recommend trying these troubleshooting steps:
npm
-> /usr/local/bin/npm
). You can find the absolute path of a command by running which
with the name of the command (e.g. which npm
)/bin/bash -c
(e.g /bin/bash -c "/usr/local/bin/npm start"
)Upvotes: 2
Reputation: 21
One thing you can do is dockerize your applications.
With docker you can run your applications in a light weight virtual machine known as containers in your computer.
This have some advantages, for example, you can run your app with port 80 inside the virtual machine and expose another port to your machine. You can start or stop the container and so forth.
Go to https://www.docker.com/what-docker for more information.
Upvotes: 1