Skip to content

After the server starts successfully, then you can ...

License

Notifications You must be signed in to change notification settings

KID-joker/serve-then

Repository files navigation

serve-then

NPM version

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

  1. 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)
  2. Ships ESM and CJS bundles.
  3. Can get the server URL.
  4. 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 => {})

License

MIT License © 2023 KID-joker

About

After the server starts successfully, then you can ...

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published