Quick start
You can install Mapl from npm.
Create a new file and add the following code:
Then run the file with Bun or Deno.
And done! We just build a simple web server running on 127.0.0.1:3000.
Explanation
-
First we create a router instance by calling
router()
. -
Then we add an endpoint that returns
Hi
as a response.You can return anything that is supported by the Response constructor, which includes
string
,ArrayBuffer
,Blob
,ReadableStream
, …Chaining is also possible since every method returns the current app instance.
-
Then we use the compiler to create an object that contains a request handler.
-
Finally we export the function correctly for the runtime to execute.