0.18.0 • Published 3 years ago

flitz v0.18.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

npm last build PRs Welcome

flitz

flitz [ˈflɪt͡s] is a lightweight and extremly fast HTTP server with all basics for Node 10+, written in TypeScript.

Install

Run

npm install --save flitz

from the folder, where your package.json is stored.

Usage

const flitz = require('flitz');

const run = async () => {
  const app = flitz();

  app.get('/', async (req, res) => {
    res.write('Hello world!');
    res.end();
  });

  await app.listen(3000);
};

run();

Or the TypeScript way:

import flitz from 'flitz';

const run = async () => {
  const app = flitz();

  app.get('/', async (req, res) => {
    res.write('Hello world!');
    res.end();
  });

  await app.listen(3000);
};

run();

Middlewares

import flitz from 'flitz';
// s. https://github.com/flitz-js/body
import { body } from '@flitz/body';

const run = async () => {
  const app = flitz();

  //             👇👇👇
  app.post('/', [ body() ], async (req, res) => {
    const body = req.body as Buffer;

    res.write('Your body as string: ' + body.toString('utf8'));
    res.end();
  });

  await app.listen(3000);
};

run();

Static files

import flitz from 'flitz';

const run = async () => {
  const app = flitz();

  app.static('/', '/path/to/my/local/files/to/serve');

  await app.listen(3000);
};

run();

TypeScript

TypeScript is optionally supported. The module contains its own definition files.

License

MIT © Marcel Kloubert

0.18.0

3 years ago

0.17.0

3 years ago

0.15.0

4 years ago

0.14.1

4 years ago

0.12.0

4 years ago

0.13.0

4 years ago

0.14.0

4 years ago

0.11.4

4 years ago

0.11.5

4 years ago

0.11.3

4 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.1

4 years ago

0.10.0

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.4

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.5.3

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.7.0

4 years ago

0.5.2

4 years ago

0.6.0

4 years ago

0.5.1

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago