#14 simple blog : cors
This commit is contained in:
@@ -7,8 +7,10 @@ const content = ref("");
|
|||||||
|
|
||||||
|
|
||||||
const write = () => {
|
const write = () => {
|
||||||
console.log("hi")
|
axios.post("/api/posts", {
|
||||||
axios.get("http://localhost:8080");
|
title: title.value,
|
||||||
|
content: content.value,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -12,4 +12,13 @@ export default defineConfig({
|
|||||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
"/api": {
|
||||||
|
target: "http://localhost:8080",
|
||||||
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
//package com.example.simpleblog.config;
|
||||||
|
//
|
||||||
|
//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 implements WebMvcConfigurer {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
// registry.addMapping("/**")
|
||||||
|
// .allowedOrigins("http://localhost:5173");
|
||||||
|
// }
|
||||||
|
//}
|
||||||
Reference in New Issue
Block a user