๐Ÿ“Œ์•Œ์•„๋‘๊ธฐ

์ž์„ธํ•œ ๋‚ด์šฉ์—†์ด ์ผ๋‹จ ์ˆœ์„œ๋งŒ ๊ธฐ๋ก

๐Ÿ™†โ€โ™€๏ธ ์‚ฌ์šฉํˆด

  1. STS
  2. VSCode
  3. node

๐ŸŽฏ ์„ค์น˜๋ฐฉ๋ฒ•

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 ํ•˜๋Š” ์ž‘์—…์ด ํ•„์š”ํ•˜๋‹ค.

profile
์•ˆ๋…•ํ•˜์„ธ์š”

0๊ฐœ์˜ ๋Œ“๊ธ€

Powered by GraphCDN, the GraphQL CDN