-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
17 lines (15 loc) · 720 Bytes
/
Copy pathMain.java
File metadata and controls
17 lines (15 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpContext;
import java.net.InetAddress;
import java.net.InetSocketAddress;
public class Main {
public static void main(String[] args) throws Exception {
InetAddress myAddress = InetAddress.getByName("0.0.0.0");
HttpServer myServer = HttpServer.create(new InetSocketAddress(myAddress, 8080), 0);
HttpContext homeContext = myServer.createContext("/", new DmdbHomeHandler());
HttpContext searchContext = myServer.createContext("/search", new DmdbSearchHandler());
HttpContext viewCardContext = myServer.createContext("/cardview", new DmdbCardViewHandler());
myServer.start();
System.out.println("Server started on port 8080.");
}
}