MelonRuntime
MelonRuntime copied to clipboard
✨ .NET-based JavaScript runtime focused in rapid prototyping of projects, using minimal dependencies and functional programming
![](https://i.imgur.com/guuToyf.png)
Melon is a declarative modern .NET JavaScript runtime.
🚀 Declarative-first programming
Create, manage and scale applications and tools easily without having to think about everything.
const { shift } = std;
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
let myValue = getRandomInt(1, 3);
shift(myValue)
.option(1 || 2, () => console.log("Cool"))
.option(3, () => console.log("Too much!"));
⚡ .NET based environment
Portable, fast and powerful applications with all the features offered by the .NET environment via functions or interop.
const system = xrequire("dotnet:System");
const consoleWriteLine = system.getType("Console").getMethod("WriteLine", 0);
consoleWriteLine.invoke(["Hello world from .NET!", null]);
//Output: Hello world from .NET!
🧤 Hands on development
Create a complete application in few lines with zero dependency.
⚡ Melon:
const app = http.app();
app.get("/", () => "Hello world");
app.run();
//App running in http://localhost:80
⛔ Node.js:
const http = require("http");
const server = http.createServer(async (req, res) => {
if (req.url === "/" && req.method === "GET") {
res.writeHead(200, { "Content-Type": "application/json" });
res.end("Hello world");
}
}
server.listen(80, () => {
console.log(`server started on port: ${80}`);
});
⛔ Deno:
const listener = Deno.listen({ port: 80 });
console.log("http://localhost:80/");
for await (const conn of listener) {
serve(conn);
}
async function serve(conn: Deno.Conn) {
for await (const { respondWith } of Deno.serveHttp(conn)) {
respondWith(new Response("Hello world"));
}
}
Installation and usage:
⛔ Melon runtime requires ASP.NET 6 and Node (NPM) installed to work
npm i melon-runtime -g
To execute Melon, just type npx melon [command]
in terminal.
Commands
-
npx melon run [script]
- Executes a script directly from the command line -
npx melon load [path]
- Loads an external entry point -
npx melon new [javascript|typescript]
- Creates a new empty Melon project in the current folder
Core Contributors
Victória Rose | Gabriel Grubba | Vinicius Lanzarini |
---|---|---|
Last Sponsors
Lucas Rufo |
---|