0.2.7 • Published 4 years ago
vitro v0.2.7
vitro
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