@ztwx/ztw-server

0.0.4 • Public • Published

web framework for node.js

const {Server}=require('@ztwx/ztw-server');
const app=new Server();

app.use(async(ctx,next)=>
  ctx.body='hello world'
);
app.listen(3000);

Installation

Before installing, download and install Node.js. Node.js 8.x or higher is required.

npm install @ztwx/ztw-server

Middleware

Static

static(UrlPath,NativeDirectory,Options)

  • UrlPath
  • NativeDirectory
  • Options
    • etag 304
    • memory use memory to cache files
    • maxAge Cache-Control max-age
    • callback return file with the current settings if no file is found.
    • gzip js,css,html
Example
const {Static,Server}=require('ztw-server')

app.use(
  Static('/static','vueDist',{
    memory:true,
    etag:true,
    maxAge:60*60*24,
    callback:'index.html'
  })
)

Router

Readme

Keywords

none

Package Sidebar

Install

npm i @ztwx/ztw-server

Weekly Downloads

2

Version

0.0.4

License

ISC

Unpacked Size

11.1 kB

Total Files

14

Last publish

Collaborators

  • buildstrap
  • hecaiming
  • echo_hx
  • lousicong
  • zhantewei