-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44eef2f
commit caefa60
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.wentong.ladder.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@Configuration | ||
public class WebConfig { | ||
|
||
@Bean | ||
WebMvcConfigurer webMvcConfigurer() { | ||
return new WebMvcConfigurer() { | ||
@Override | ||
public void addCorsMappings(CorsRegistry registry) { | ||
registry.addMapping("/form/submit").allowedOrigins("http://localhost:8081").allowedMethods("POST"); | ||
} | ||
}; | ||
} | ||
|
||
} | ||
|
18 changes: 18 additions & 0 deletions
18
src/main/java/com/wentong/ladder/controller/FormController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.wentong.ladder.controller; | ||
|
||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.Map; | ||
|
||
@RestController | ||
@RequestMapping("/form") | ||
public class FormController { | ||
|
||
@PostMapping("/submit") | ||
public String submit(@RequestBody Map map) { | ||
// TODO | ||
System.out.println(map); | ||
return "success"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters