Skip to content

Commit 0f13829

Browse files
committed
Remove fixed hostname
1 parent 242248e commit 0f13829

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ app.get("/", (req, res) -> {
3838
app.listen(); // Will listen on port 80 which is set as default
3939
```
4040

41-
When you create an new Express instance you can add an additional host name for example, your local network:
42-
```java
43-
// Will bind the server to your ip-address
44-
Express app = new Express(Utils.getYourIp());
45-
```
46-
Default is localhost, so you can access, without setting the hostname, only from your local machine.
47-
4841
# Docs:
4942
* [Routing](#routing)
5043
* [Direct](#direct)

src/main/java/express/Express.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public class Express implements Router {
4242
HANDLER = new FilterLayerHandler(2);
4343

4444
executor = Executors.newCachedThreadPool();
45-
hostname = "localhost";
4645
}
4746

4847
/**
@@ -258,11 +257,11 @@ public void listen(ExpressListener onStart) {
258257
public void listen(ExpressListener onStart, int port) {
259258
new Thread(() -> {
260259
try {
260+
261261
// Fire worker threads
262262
WORKER.forEach(FilterWorker::start);
263263

264-
InetSocketAddress socketAddress = new InetSocketAddress(this.hostname, port);
265-
264+
InetSocketAddress socketAddress = this.hostname == null ? new InetSocketAddress(port) : new InetSocketAddress(this.hostname, port);
266265
if (httpsConfigurator != null) {
267266

268267
// Create https server

0 commit comments

Comments
 (0)