vite-plugin-11th-server
v1.0.0
Published
A vite plugin that fast build server
Downloads
7
Readme
vite-plugin-11th-server
A vite plugin that fast build server
Install
npm install vite-plugin-11th-serverUsage
- vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { xiServerPlugin, XiServer } from 'vite-plugin-11th-server';
import { resolve } from 'path';
export default defineConfig({
plugins: [
vue(),
xiServerPlugin({
server: (app: XiServer) => {
app.router('/hello', (req, res) => {
res.end('hello world');
});
app.router('/api', (req, res) => {
res.send(req.body);
});
},
port: 8088,
outDir: resolve(__dirname, 'dist')
})
]
});XiPluginOptions
server: (app: XiServer, wss?: WebSocketServer) => void;
serverDir:string;
port?: number;
wsPort?: number;
outDir?: string;Install Other
- Build must
npm install connect
npm install serve-static- WebSocket must
npm install wsBuild
npm run buildRun Server
node ./dist/server.jsOpen
web http://localhost:8088/ server http://localhost:8088/hello
