Reputation: 7144
I figured that I can manage multiple apps using location in nginx
.
But it seems like I cannot run multiple dancer2
apps in same server with different ports (like localhost:3000, localhost:4000).
Anyway I'm putting this here with a hope that experts can show me some light.
Upvotes: 3
Views: 492
Reputation: 69224
But it seems like I cannot run multiple
dancer2
apps in same server with different ports (like localhost:3000, localhost:4000).
This isn't true. Dancer (and, obviously, Dancer2) apps know nothing about the port that they are listening to. That is all handled by your deployment environment. If, for example, you have two Dancer apps called app1.psgi
and app2.psgi
and you are starting them with plackup
, then you can get them running on different ports using the -p
command line option.
$ plackup -p 3000 app1.psgi
$ plackup -p 4000 app2.psgi
Upvotes: 2
Reputation: 21666
When you have multiple Dancer2 applications, you can compose them together using either Plack::App::URLMap or the wrapper syntax for it available in Plack::Builder:
use MyApp::Main;
use MyApp::Admin;
builder {
mount '/' => MyApp::Main->to_app;
mount '/admin' => MyApp::Admin->to_app;
};
The effect of the mounting is that these applications will be completely separate and Plack::Builder will assure only the appropriate application handles a given request.
Source: http://advent.perldancer.org/2014/9
Upvotes: 4