Make port configurable
This commit is contained in:
@@ -14,7 +14,12 @@ import static spark.Spark.*;
|
||||
public class Server {
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
public static void main(String[] args) {
|
||||
port(8080);
|
||||
if (args.length >= 1) {
|
||||
port(Integer.parseInt(args[0]));
|
||||
} else {
|
||||
port(8080);
|
||||
}
|
||||
|
||||
post("/ngx/create", (req, res) -> {
|
||||
JsonObject jsonObject = GSON.fromJson(req.body(), JsonObject.class);
|
||||
TextStorage ts = TextStorage.createPaste(jsonObject.get("content").getAsString());
|
||||
|
||||
Reference in New Issue
Block a user