Socket
Socket
Sign inDemoInstall

create-serve

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    create-serve

🍛 Ultralight http server with live reload. [CLI + API]


Version published
Weekly downloads
4.2K
decreased by-7.35%
Maintainers
1
Install size
18.7 kB
Created
Weekly downloads
 

Readme

Source

Serve 🍛

Ultralight http server with live reload.
CLI + API


Simple CLI and API

With live reload

Light and modern

No dependencies


One command

npm init serve

Or one function

import serve from 'create-serve';

serve.start();

To start 🍛


CLI

By default, it serves public if the folder exists, otherwise root /.
Or you can specify a different folder.

npm init serve [folder]

API

import serve from 'create-serve';

serve.start({
    port: 7000,
    root: '.',
    live: true
});

Live reload

serve.update();

Use any file watcher


Chokidar

import serve from 'create-serve';
import chokidar from 'chokidar';

serve.start();

chokidar.watch('.').on('change', () => {
    serve.update();
});

esbuild

Use the official wrapper for esbuild's watch   →   esbuild-serve


Log

Import the util functions to log updates with colours.

import serve, { error, log } from 'create-serve';

serve.update();

hasError
    ? error('× Failed') // Red
    : log('✓ Updated'); // Green



Native Web

Keywords

FAQs

Last updated on 13 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc