1.3.0 • Published 4 years ago

nerver v1.3.0

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

Nerver

A node simple Server, create a ts(TypeScript) file, and respond your body, just like a static server or PHP.

# open a dir, just run nerver
npx nerver

# need node, npm(with npx)

Create or Edit ./xxx.ts:

export default (ctx) => {
    return {
        Hello: 'Nerver'
    }
}

visit http://127.0.0.1:3000/xxx, you will got {"Hello":"Nerver"};

  • QA - 常见问题
  • e.g. - 示例

ENV

port=3001 nerver

or

Create .env:

port=3001

Static Server

Any static file, but *.ts and .*.

/index.html => got `/index.html` or `/index.html.ts`
/any.json => got `any.json` or `any.json.ts`
/any.jpg => got `any.jpg` or `any.jpg.ts`
...
/any.ts => got `Not Found`
/.env => got `Not Found`

ctx

Just a koa context - https://koajs.com/#context

ctx.query
ctx.request.body
ctx.request.fields
ctx.request.files
ctx.cookies.get(key)
ctx.cookies.set(key, value)
1.3.0

4 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.1-rc.1

5 years ago

1.1.0

5 years ago

1.1.0-rc.3

5 years ago

1.1.0-rc.2

5 years ago

1.1.0-rc.1

5 years ago

1.0.5

5 years ago

1.0.5-rc.2

5 years ago

1.0.5-rc.1

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.2-rc.2

5 years ago

1.0.2-rc.1

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.0

5 years ago