serve-then
v1.0.0
Published
After the server starts successfully, then you can ...
Downloads
5
Readme
serve-then
Inspired by start-server-and-test, but this isn't a cli tool. It will run a server in the child_process, and return the URL, then you can do what you want. When the current process ends, the child_process will also end.
features
- Based on and offering all features of live-server, But it has a few changes:
- convert start/shutdown into Promise style.
- reject if port is specified and already in use. (0 means random)
- Ships ESM and CJS bundles.
- Can get the server URL.
- Destroy child_process following the current process.
usage
import { serve, serveOptions } from 'serve-then'
serve(options as serveOptions).then(url => {
// serving root at url
}).catch(err => {})