Skip to content

Commit

Permalink
add mapljs
Browse files Browse the repository at this point in the history
  • Loading branch information
waghanza committed Jan 19, 2025
1 parent c9fa153 commit 6252f06
Show file tree
Hide file tree
Showing 25 changed files with 57,254 additions and 57,126 deletions.
114,180 changes: 57,088 additions & 57,092 deletions data.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data.min.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion javascript/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ language:
deno:
bootstrap:
- deno install
command: deno serve --parallel --allow-net --allow-read=. --allow-env app.ts
command: deno serve --parallel --port 3000 --allow-net --allow-read=. --allow-env app.ts
happyx:
bootstrap:
- npm install
Expand All @@ -49,5 +49,7 @@ framework:

files:
- '**/*.js'
- '**/*.cjs'
- '**/*.mjs'
- '**/*.ts'
- '**/*.json'
22 changes: 14 additions & 8 deletions javascript/fast/app.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import fast from "https://deno.land/x/fast@6.0.0-alpha.1/mod.ts";

// Create the Fast app
const app = fast();

app.get("/", () => "");
app.get("/user/:id", (req) => req.params.id);
app.post("/user", () => "");
// Define routes
app.get("/", (req, res) => {
res.text("Welcome to Fast with Deno Serve!");
});

export default {
reusePort: true,
port: 3000, // Port to run the server on
fetch: app.serve, // Use the `app.serve` method to handle requests
};
app.get("/json", (req, res) => {
res.json({ message: "This is a JSON response from Fast!" });
});

app.get("/hello/:name", (req, res) => {
const name = req.params.name;
res.text(`Hello, ${name}!`);
});

export default { fetch: app.handle }
5 changes: 5 additions & 0 deletions javascript/fast/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"fast": "npm:fast@^2.8.2"
}
}
4 changes: 2 additions & 2 deletions javascript/hono-deno/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Hono } from "https://deno.land/x/hono/mod.ts";
import { Hono } from '@hono/hono'

const app = new Hono();

app.get("/", (c) => c.text(""));
app.get("/user/:id", (c) => c.text(c.req.param("id")));
app.post("/user", (c) => c.text(""));

Deno.serve({ port: 3000 }, app.fetch);
export default app;
5 changes: 5 additions & 0 deletions javascript/hono-deno/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@hono/hono": "jsr:@hono/hono@^4.6.17"
}
}
9 changes: 9 additions & 0 deletions javascript/hono-node/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Hono } from "https://deno.land/x/hono/mod.ts";

const app = new Hono();

app.get("/", (c) => c.text(""));
app.get("/user/:id", (c) => c.text(c.req.param("id")));
app.post("/user", (c) => c.text(""));

export default app;
14 changes: 14 additions & 0 deletions javascript/hono-node/cluster.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import cluster from 'node:cluster';
import { availableParallelism } from 'node:os';

const numCpus = availableParallelism();
import { serve } from "@hono/node-server";
import app from './app.js';

if (numCpus > 1 && cluster.isPrimary) {
for (let i = 0; i < numCpus; i++) {
cluster.fork();
}
} else {
serve(app);
}
3 changes: 3 additions & 0 deletions javascript/hono-node/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
website: hono.dev
version: 4.6
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "module",
"dependencies": {
"@hono/node-server": "*",
"hono": "~4.6.0"
}
}
11 changes: 11 additions & 0 deletions javascript/hono/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Hono } from 'hono';

const app = new Hono();

app.get("/", (c) => c.text(""));
app.get("/user/:id", (c) => c.text(c.req.param("id")));
app.post("/user", (c) => c.text(""));

export default {
fetch: app.fetch,
}
10 changes: 10 additions & 0 deletions javascript/hono/cluster.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { availableParallelism } from 'node:os';

const numCpus = availableParallelism();

for (let i = 0; i < numCpus; i++) {
Bun.spawn(['bun', 'app.ts'], {
stdio: ['inherit', 'inherit', 'inherit'],
env: { ...process.env },
});
}
3 changes: 3 additions & 0 deletions javascript/hono/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
framework:
website: hono.dev
version: 4.6

engines:
- bun
11 changes: 8 additions & 3 deletions javascript/hono/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"type": "module",
"name": "tot",
"scripts": {
"dev": "bun run --hot src/index.ts"
},
"dependencies": {
"@hono/node-server": "*",
"hono": "~4.6.0"
"hono": "^4.6.17"
},
"devDependencies": {
"@types/bun": "latest"
}
}
9 changes: 9 additions & 0 deletions javascript/mapljs/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { router, jitc } from '@mapl/app';

const app = router()
.get('/', () => '')
.post('/user', () => '')
.get('/user/*', (params) => params[0]);

// Port 3000
export default await jitc(app, { exposeStatic: true });
6 changes: 6 additions & 0 deletions javascript/mapljs/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework:
github: mapljs/app
version: 0.5

engines:
- deno
5 changes: 5 additions & 0 deletions javascript/mapljs/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@mapl/app": "npm:@mapl/app@~0.5.12"
}
}
17 changes: 0 additions & 17 deletions javascript/nhttp/app.js

This file was deleted.

18 changes: 18 additions & 0 deletions javascript/nhttp/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import nhttp from "@nhttp/nhttp";

const app = nhttp();

app.get('/', () => {
return new Response();
});

app.get('/user/:id', (rev) => {
return new Response(rev.params.id);
});

app.post('/user', () => {
return new Response();
});

export default {fetch: app.handle };

5 changes: 4 additions & 1 deletion javascript/nhttp/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
framework:
website: nhttp.deno.dev
version: 1.3
version: 2.0

engines:
- deno
5 changes: 5 additions & 0 deletions javascript/nhttp/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@nhttp/nhttp": "jsr:@nhttp/nhttp@~2.0.2"
}
}
15 changes: 15 additions & 0 deletions javascript/totaljs/app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "total5";

ROUTE("GET /", function ($) {
$.text("");
});

ROUTE("GET /user/{id}/", function ($) {
$.text($.params.id);
});

ROUTE("POST /user/", function ($) {
$.text("");
});

export default Total
13 changes: 13 additions & 0 deletions javascript/totaljs/cluster.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import cluster from 'node:cluster';
import { availableParallelism } from 'node:os';

const numCpus = availableParallelism();
import app from './app.mjs';

if (numCpus > 1 && cluster.isPrimary) {
for (let i = 0; i < numCpus; i++) {
cluster.fork();
}
} else {
app.run({ port: 3000, release: true, watcher: false });
}
3 changes: 2 additions & 1 deletion javascript/totaljs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": {
"total5": "~0.0.6"
}
},
"type": "module"
}

0 comments on commit 6252f06

Please sign in to comment.