added web template
This commit is contained in:
@@ -2,27 +2,33 @@ package nl.herpiederpiee.appie_scraper;
|
|||||||
|
|
||||||
import com.microsoft.playwright.*;
|
import com.microsoft.playwright.*;
|
||||||
import org.json.*;
|
import org.json.*;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
BonusManager.updateBonusItems();
|
BonusManager.updateBonusItems();
|
||||||
Scanner input = new Scanner(System.in);
|
|
||||||
|
|
||||||
|
|
||||||
|
// start the webserver
|
||||||
|
SpringApplication.run(Main.class, args);
|
||||||
|
|
||||||
while (true) {
|
// while (true) {
|
||||||
System.out.println("\n\nWhat item would you like to look for?");
|
// System.out.println("\n\nWhat item would you like to look for?");
|
||||||
String userInput = input.nextLine();
|
// String userInput = input.nextLine();
|
||||||
if (userInput.equals("qqq")) break;
|
// if (userInput.equals("qqq")) break;
|
||||||
ArrayList<BonusItem> userResults = BonusManager.getBonusItems(userInput);
|
// ArrayList<BonusItem> userResults = BonusManager.getBonusItems(userInput);
|
||||||
|
//
|
||||||
for (BonusItem bonusItem : userResults) {
|
// for (BonusItem bonusItem : userResults) {
|
||||||
System.out.println(bonusItem.title + " => " + bonusItem.bonusText);
|
// System.out.println(bonusItem.title + " => " + bonusItem.bonusText);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/main/java/nl/herpiederpiee/appie_scraper/WebServer.java
Normal file
12
src/main/java/nl/herpiederpiee/appie_scraper/WebServer.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package nl.herpiederpiee.appie_scraper;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class WebServer {
|
||||||
|
@GetMapping("/")
|
||||||
|
public String index() {
|
||||||
|
return "index"; // resolves to index.html in templates/
|
||||||
|
}
|
||||||
|
}
|
||||||
2
src/main/resources/application.properties
Normal file
2
src/main/resources/application.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
server.port=9823
|
||||||
|
spring.application.name=AppieBonusScraper
|
||||||
10
src/main/resources/templates/index.html
Normal file
10
src/main/resources/templates/index.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Appie Scraper</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Hello World</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user