0.0.15 • Published 9 months ago

@zipadee/static v0.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@zipadee/static

Static file serving utilities and middleware for the Zipadee web server.

!CAUTION Zipadee is very early, under construction, will change a lot, and may never be sufficiently maintained for any level of use. If you want to try it, please consider contributing!

@zipadee/static has two main exports:

  • send: a helper function which sends a single file - by file path - to a Response
  • serve: middleware that serves a folder of files

Usage

import {App} from 'zipadee';
import {send, serve} from '@zipadee/static';

const app = new App();

// Serves all files in the directory {cwd}/files/
app.use(serve({root: 'files'}));

app.use(async (req, res, next) => {
  if (req.path === '/hello') {
    // Sends {cwd}/hello.html to the response
    await send(req, res, 'hello.html');
  }
  await next();
});

app.listen();
0.0.15

9 months ago

0.0.14

11 months ago

0.0.12

11 months ago

0.0.13

11 months ago

0.0.11

11 months ago

0.0.10

12 months ago

0.0.9

12 months ago

0.0.8

12 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago