Port Mapping
Port mapping on codedamn playgrounds is very powerful. Ports are how you can run different applications accessible over a network together on a single computer.
We currently provide you with two ports (port 1337 and port 1338) where you can host your HTTP or WebSocket services.
Note: Currently, we do not support any arbitrary TCP traffic on these ports except for HTTP and WebSocket traffic. This means, you cannot run, say, a MySQL DB server on port 1337 and connect it from your local computer.
Every time you boot a playground, you get a unique hostname assigned to you (example: hello-world.codedamn.app
)
This hostname belongs to your app as long as your playground has at least one collaborator online.
For now, these host names are temporary so please do not use them/hardcode them in your programs because your program would stop working the next time your playground boots afresh.
This hostname has two special ports - 1337, 1338. Anything you run on port 1337 and 1338 inside the linux computer provided to you would be mapped over to hello-world.codedamn.app:1337
and hello-world.codedamn.app:1338
respectively.
In other words, whenever someone visits hello-world.codedamn.app:1337
, we would forward all the traffic to your localhost:1337
port. There are two main things you have to remember here:
- We give you TLS termination (https support) automatically. This is mandatory and not by passable.
- This traffic passing currently works only for HTTP and WebSocket traffic. We would not proxy any raw TCP traffic (like connecting to MongoDB listening on port 1338 on the container, from your local computer on that hostname would not work)
The details of port mapping are provided to you in Settings menu as well:
Note: It is important to expose the server you're running on all hosts on port 1337. For example, it is better to run on 0.0.0.0:1337
, instead of 127.0.0.1:1337
- otherwise your application might be inaccessible on internet.