npm.io
0.2.7 • Published 6 years agoCLI

vitro

Licence
MIT
Version
0.2.7
Deps
3
Size
13 kB
Vulns
0
Weekly
0

vitro

Version Build Coverage License

Experimental Fetch API based web framework.

Installation

npm install vitro

Usage

CLI

Create an index.js file and export a function that accepts Request object and returns imported Response object (supports promises).

const { Response } = require('vitro');

module.exports = request => new Response('Welcome to server, Fetch API!');

Add to you package.json:

{
  "main": "index.js",
  "scripts": {
    "start": "vitro"
  }
}

Start server with:

npm start

Go to http://localhost:3000

Use vitro --help for more info.

Programmatic use
const vitro = require('vitro');
const { Response } = vitro;

const server = vitro(request => new Response('Welcome to server, Fetch API!'));

server.listen(3000);

Go to http://localhost:3000

Keywords