0.2.7 • Published 5 years ago
vitro v0.2.7
vitro
Experimental Fetch API based web framework.
Installation
npm install vitroUsage
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 startGo 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