slet-plugin-static

1.0.1 • Public • Published

slet-plugin-static

NPM version Build codecov.io js-standard-style

Install

$ npm i -S slet-plugin-static

Usages

'use strict'

const StaticPlugin = require('.')

const Slet = require('slet')

// 经典用法
Slet.plugin(StaticPlugin)

const app = new Slet({
  root: __dirname,
  debug: false
})

// lazy load plugin
app.static()

// app.start(3005)
module.exports = app

步骤

  • 1)const StaticPlugin = require('.')
  • 2)Slet.plugin(StaticPlugin)
    1. app.static()

参数

const app = new Slet({
  root: __dirname,
  debug: false,
  static: {
    path: this.opts.root + '/public',
    opts: {} // https://github.com/koajs/static#options
  }
})
  • path即static server的目录,默认是当前目录下的public目录

更多参见:https://github.com/koajs/static#options

Readme

Keywords

none

Package Sidebar

Install

npm i slet-plugin-static

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • zhaoxingyue
  • zhangyuang
  • langshu