# vue+express **Repository Path**: null_git/vue-express ## Basic Information - **Project Name**: vue+express - **Description**: 『Vue+Express』前后端联合案例【基础案例】 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-02-23 - **Last Updated**: 2022-08-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: Vue, Express ## README ### 『Vue+Express』前后端联合案例【基础案例】 #### client ```js npm i vite -D npm i @vitejs/plugin-vue -D npm i vue@3.2.26 npm i axios qs lodash ``` #### server ```js npm i body-parser -D npm i express ``` #### vite.config.js ```js import {defineConfig} from 'vite'; import vue from '@vitejs/plugin-vue'; export default defineConfig ({ plugins: [vue()], resolve: { extensions: ['.vue', '.js', '.jsx'] }, server: { proxy: { '/api': { target: 'http://localhost:8081', changeOrigin: true, rewrite: path => path.replace(/^\/api/, '') } } } }) ``` #### Server/app.js ```js const express = require('express'), bodyParser = require('body-parser'); const app = express(); app.use(bodyParser.urlencoded({extended: true})) app.use(bodyParser.json()); app.listen('8081', () => { console.log('Server is PORT 8081!!!') }) ```