์์ธํ ๋ด์ฉ์์ด ์ผ๋จ ์์๋ง ๊ธฐ๋ก
1. STS์์ Spring Stater Project ์์ฑ
2. VSCode์์ ์์ฑ๋ ํ๋ก์ ํธ ์ด๊ธฐ
3. ์์ฑ๋ ํ๋ก์ ํธ์์ Crtl + '
์ผ๋ก ํฐ๋ฏธ๋์ด๊ธฐ
4. npm install -g @vue/cli
5. vue create frontend
6. defalut (vue3)
์ ํ
7. cd frontend
8. application.properties ์์ server.port=8081
๋ก ์ค์
9. vue.config.js ์์
const { defineConfig } = require('@vue/cli-service')
module.exports = {
// ๋น๋ ํ๊ฒ ๋๋ ํ ๋ฆฌ
outputDir: "../src/main/resources/static",
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8081',
changeOrigin: true,
pathRewrite: {
'^/api': '',
},
},
},
},
}
10. package.json ์์
"build": "vue-cli-service build ๋ฅผ
"build": "vue-cli-service build --Watch ๋ก ์์
vscode์์ npm run serve
๋ก ์คํ๊ฐ๋ฅ
STS์์ Run As - Spring Boot App ์ผ๋ก ์คํ๊ฐ๋ฅ
๊ธฐ์กด์ ์ฌ์ฉํ๋ Spring๊ณผ Jsp๊ตฌ์กฐ์๋ ๋ง์ด ๋ค๋ฅธ๋ฏํ๋ค. ๊ธฐ์กด ๊ตฌ์กฐ๋ Backend์ Frontend๊ฐ ํฉ์ณ์ ธ ์๋ค ์๊ฐํ๋ค๋ฉด, Vue(Frontend) + SpringBoot(Backend)๋ก ๊ตฌ๋ถ๋์ด ์๋ค.
๋จ์ํ ๋ฐ์ดํฐ๊ฐ ํ์ํ์ง์๊ณ ํ๋ฉด๋ง ํ์ธํ๋ค๋ฉด npm run serve
๋ก ํ์ธํ๊ณ , ๋ง์ฝ ๋ฐ์ดํฐ๋ฅผ ์์ฒญํด์ ๊ฐ์ ธ์ฌ๊ฑฐ๋ผ๋ฉด STS์์ Run As - Spring Boot App ํ๋ ์์
์ด ํ์ํ๋ค.