1.0.1 • Published 10 months ago

flickserve v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

flickserve 🍛

Ultralight http server with live reload.
CLI + API

This is fork of nativew/serve. I missed fallback option usefull for apps with react router

Simple CLI and API

With live reload

Light and modern

No dependencies

One command

npm init flickserve

Or one function

import flickserve from 'flickserve';

flickserve.start();

To start 🍛

CLI

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

npm init flickserve [folder]

API

import flickserve from 'flickserve';

flickserve.start({
    port: 7000,
    root: '.',
    fallback: undefined, // set to "index.html", great for react router etc.
    live: true
});

Live reload

serve.update();

Use any file watcher

Chokidar

import flickserve from 'flickserve';
import chokidar from 'chokidar';

flickserve.start();

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

esbuild

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

Log

Import the util functions to log updates with colours.

import flickserve, { error, log } from 'flickserve';

flickserve.update();

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