-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
79 additions
and
106 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -6,3 +6,5 @@ pnpm-lock.yaml | |
http/grpc_example/*.pem | ||
http/grpc_example/pb | ||
http/grpc_example/server | ||
cert.pem | ||
private.pem |
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
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,8 +1,10 @@ | ||
import { Server } from 'https://deno.land/[email protected]/http/server.ts' | ||
const port = 3000 | ||
|
||
const url = new URL(import.meta.resolve('./cookie.png')) | ||
|
||
/** | ||
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition | ||
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range | ||
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type | ||
*/ | ||
// const handler = async (req: Request) => { | ||
// // const body = `Your user-agent is:\n\n${req.headers.get('user-agent')}` | ||
// const body = await Deno.readFile(url) | ||
|
@@ -48,9 +50,11 @@ const handler = async (req: Request) => { | |
return new Response('Not Found', { status: 404 }) | ||
} | ||
|
||
const server = new Server({ handler }) | ||
const listener = Deno.listen({ port }) | ||
|
||
console.log(`Listening on http://localhost:${port}/`) | ||
|
||
await server.serve(listener) | ||
Deno.serve( | ||
{ | ||
onListen({ port }) { | ||
console.log(`Listening on http://localhost:${port}/`) | ||
}, | ||
}, | ||
handler | ||
) |