创建后端

This commit is contained in:
2023-01-13 20:05:36 +08:00
parent 5f1513a0bb
commit 11bda8e9f3
13 changed files with 666 additions and 0 deletions
@@ -0,0 +1,13 @@
package com.kob.backend;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BackendApplication {
public static void main(String[] args) {
SpringApplication.run(BackendApplication.class, args);
}
}
@@ -0,0 +1,28 @@
package com.kob.backend.controller.pk;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/pk/")
public class BotinfoController {
@RequestMapping("getbotinfo/")
public List<Map<String, String>> getBotInfo() {
List<Map<String, String>> list = new LinkedList<>();
Map<String, String> bot1 = new HashMap<>();
bot1.put("name", "tiger");
bot1.put("rating", "1500");
Map<String, String> bot2 = new HashMap<>();
bot2.put("name", "apple");
bot2.put("rating", "1800");
list.add(bot1);
list.add(bot2);
return list;
}
}
@@ -0,0 +1,14 @@
package com.kob.backend.controller.pk;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/pk/")
public class indexController {
@RequestMapping("index/")
public String index(){
return "pk/index.html";
}
}
@@ -0,0 +1,2 @@
#??????
server.port=3000
Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div style="text-align: center">
<img src="/image/img.png">
</div>
</body>
</html>
@@ -0,0 +1,13 @@
package com.kob.backend;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BackendApplicationTests {
@Test
void contextLoads() {
}
}