-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
57,254 additions
and
57,126 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"imports": { | ||
"fast": "npm:fast@^2.8.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"imports": { | ||
"@hono/hono": "jsr:@hono/hono@^4.6.17" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
framework: | ||
website: hono.dev | ||
version: 4.6 |
1 change: 1 addition & 0 deletions
1
javascript/hono-deno/package.json → javascript/hono-node/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"type": "module", | ||
"dependencies": { | ||
"@hono/node-server": "*", | ||
"hono": "~4.6.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
framework: | ||
website: hono.dev | ||
version: 4.6 | ||
|
||
engines: | ||
- bun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
framework: | ||
github: mapljs/app | ||
version: 0.5 | ||
|
||
engines: | ||
- deno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"imports": { | ||
"@mapl/app": "npm:@mapl/app@~0.5.12" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"imports": { | ||
"@nhttp/nhttp": "jsr:@nhttp/nhttp@~2.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"dependencies": { | ||
"total5": "~0.0.6" | ||
} | ||
}, | ||
"type": "module" | ||
} |