Nativew Serve Save

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

Project README

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

Open Source Agenda is not affiliated with "Nativew Serve" Project. README Source: nativew/serve
Stars
28
Open Issues
8
Last Commit
1 year ago
Repository
License
ISC

Open Source Agenda Badge

Open Source Agenda Rating