This guide will help you set up a basic Midori application in just a few steps.
First, create a new Node.js project:
mkdir my-midori-app && cd my-midori-app
npm init -y
npm install modscleo4/midori
Create a server.js
file with the following content:
import { Server, Response } from 'midori';
const server = new Server();
server.pipe(async (req, next) => {
return Response.json({ message: 'Hello, World!' });
});
server.listen(8080, () => {
console.log('Server is running on http://localhost:8080');
});
Run your server with:
node server.js
Visit http://localhost:8080
in your browser, and you should see a JSON response!
See the Examples for more advanced usage of Midori.