1.0.0 • Published 2 years ago

vite-plugin-11th-server v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vite-plugin-11th-server

A vite plugin that fast build server

Install

 npm install vite-plugin-11th-server

Usage

  • 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 ws

Build

 npm run build

Run Server

 node ./dist/server.js

Open

web http://localhost:8088/ server http://localhost:8088/hello

1.0.0

2 years ago

0.0.4

2 years ago

0.0.4-beta.2

2 years ago

0.0.4-beta.1

2 years ago

0.0.3

2 years ago

0.0.3-beta.2

2 years ago

0.0.3-beta.1

2 years ago

0.0.2

2 years ago

0.0.1-beta.2

2 years ago

0.0.1-beta.1

2 years ago

0.0.0

2 years ago

0.0.0-beta.5

2 years ago

0.0.0-beta.4

2 years ago

0.0.0-beta.3

2 years ago

0.0.0-beta.2

2 years ago

0.0.0-beta.1

2 years ago