A. Create server through node
Use the terminal to open the vue_demo_server folder. Enter the command NPM init-y
const express = require('express')
const app = express()
app.use(express.static('./dist'))
app.listen(8998,()=>{
console.log("server running at http://127.0.0.1:8998")
})
- and then enter node app.js in the terminal again to start the project.
B. Open gzip compression
- open the terminal of the vue_demo_server folder, enter the command: NPM I compression -d
- open app.js, and write the code:
const express = require('express')
const compression = require('compression')
const app = express()
app.use(compression()) // 注册中间件 一点要写在静态托管之前
app.use(express.static('./dist')) //
app.listen(8998,()=>{
console.log("server running at http://127.0.0.1:8998")
})
Js
open the page and you will find:
relatively large files have been gzip enabled.
Read More:
- [Linux] solve the error of decompressing JDK on Linux gzip: stdin: not in gzip format
- [Four Methods] memcached unzip error: gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- Bitmap optimization and memory optimization
- Node start – create a server listening port.
- Node configuration environment variable and global installation of webapck
- Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtim
- Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit
- Anaconda create environment, delete environment, activate environment, exit environment
- Location and optimization of server IO high problem
- Win7 system build PHP + MySQL + Apache environment + deploy ECSHOP project
- Optimization method of vs2017 starting speed
- Module build failed: Error: ENOENT: no such file or directory, scandir,‘node_modules\node-sass\vend’
- [unable to read project file xxxxx, XXX failed to load project file, name cannot start with “<" character (hex value 0x3c)] exception handling method
- The Vue project does not install node sass and an error is reported
- Import / export. SQL file / gzip file for MySQL under Linux
- Optimization and upgrade solution for one click deployment without Jenkins under Linux
- The. Exe crashed program ends abnormally when the QT project is copied to the new environment
- Eclipse automatic prompt setting method and optimization
- Error: EPERM: operation not permitted, mkdir ‘D:\nodejs\node_modules\npm\node_cache\_npx‘
- The web project removal server reports an error, and the web project in eclipse cannot be automatically deployed to Tomcat