API Reference

svrx(option)

Get the instance of Svrx

Usage

const svrx = require('@svrx/svrx');

const server = svrx({
  port: 8002
});

Param

Return

the instance of Svrx

server.start()

Start svrx

Usage

server.start().then(port => {
  console.log(port);
});

Return

Promise

server.close()

Usage

Param

Return

Promise

server.reload()

Manually refresh the browser

Usage

server.on

Attach event listener

builtin events

1. ready

Emit when svrx start

2. plugin

Emit after plugin building, as same as hook.onCreate, see How to create plugin for more details

3. file:change

emit after file change (make sure that livereload is enable)

server.off

unbind specific event

server.emit

Last updated

Was this helpful?