From eee5ebaa3bf71827d3e5819b0606446a6ce6c00f Mon Sep 17 00:00:00 2001 From: minseokkang Date: Fri, 11 Nov 2022 11:46:14 +0900 Subject: [PATCH] fix : vue.js auto build code ADD --- build.gradle | 23 +++++++++++++++++++ .../com/io/realworld/security/WebConfig.java | 2 +- src/main/resources/templates/index.html | 10 ++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e8a7298..ffa9e31 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,15 @@ plugins { id 'org.springframework.boot' version '2.7.3' id 'io.spring.dependency-management' version '1.0.13.RELEASE' id 'java' + id "com.github.node-gradle.node" version "3.1.1" +} + +node { + version = '14.15.4' + npmVersion = '6.14.10' + workDir = file("./src/frontend") + npmWorkDir = file("./src/frontend") + nodeModulesDir = file("./src/frontend") } group = 'com.io' @@ -42,3 +51,17 @@ dependencies { tasks.named('test') { useJUnitPlatform() } + +task setUp(type: NpmTask){ + description = "Install Node.js packages!" + args = ['install'] + inputs.files file('package.json') + outputs.files file('node_modules'); +} + +task buildFrontEnd(type: NpmTask, dependsOn: setUp){ + description = "Build Vue.js" + args = ['run', 'build'] +} + +processResources.dependsOn 'buildFrontEnd' \ No newline at end of file diff --git a/src/main/java/com/io/realworld/security/WebConfig.java b/src/main/java/com/io/realworld/security/WebConfig.java index 0db65bd..f1ad5a4 100644 --- a/src/main/java/com/io/realworld/security/WebConfig.java +++ b/src/main/java/com/io/realworld/security/WebConfig.java @@ -34,7 +34,7 @@ public class WebConfig { public SecurityFilterChain resources(HttpSecurity http) throws Exception { http.csrf().disable() .requestMatchers((matchers) -> {matchers.antMatchers("/h2-console/**"); - matchers.antMatchers(HttpMethod.GET,"/api/articles/**");}) + matchers.antMatchers(HttpMethod.GET,"/api/articles/**","/");}) .authorizeHttpRequests((authorize) -> authorize.anyRequest().permitAll()) .requestCache().disable() .securityContext().disable() diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index e69de29..67bbec3 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -0,0 +1,10 @@ + + + + + Title + + +hello + + \ No newline at end of file