뷰 설치 및 필요 npm 설치
npm init
npm i
npm i -g npm@latest
npm i -g @vue/cli
npm i axios
npm run serve
vue.config.js에 연결 작업
프론트 : 8080 / 백 : 9000
devServer: {
proxy: {
"/api": {
target: 'http://localhost:9000/',
pathRewrite: {'^/': ''},
changeOrigin: true
}
},
port : 8080
},
axios 사용법
<script>
export default {
methods: {
함수명(){
axios.post('매핑주소',{
// 보낼 데이터
}).then((res) => {
// 응답
console.log(res)
}).catch((err)=>{
console.log(err)
})
}
}
}
</script>
'웹개발 지식' 카테고리의 다른 글
문자 바이트 (0) | 2023.03.22 |
---|---|
AES-256 사용법 및 예제 (0) | 2023.02.06 |
JOIN 및 쿼리 연산자 (0) | 2023.01.30 |
포스트맨 (0) | 2023.01.02 |
No Mybatis mapper was found in '' package (0) | 2023.01.02 |