0.1.3 • Published 5 years ago

spa-static-server v0.1.3

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

spa-static-server

为打包过后单页应用(spa)提供一个服务

  • 能够路由静态文件(js、css 等)
  • 能够代理接口
  • 将默认地址指向同一个html文件

安装

    yarn add spa-static-server

config

在执行目录下创建server.config.js
module.exports = {
    host: 'http://xxx.xxx.xxx',                 // 启动域名
    html: `${process.cwd()}/dist/index.html`,   // html位置
    staticRoot: `${process.cwd()}/dist`,        // 静态文件根目录
    proxy: {                                    // 接口代理配置,http-proxy-middleware
        '/api': { target: 'http://xxx.xxx.xxx:9999' },
    }
}

使用

package.json
"scripts":{
    "server":"v-server"
}

执行 yarn server

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago