mirror of
https://github.com/rjNemo/deno_tuto
synced 2026-06-06 02:26:40 +00:00
add jsdoc
This commit is contained in:
parent
36e2d0d9a6
commit
ff9b368f1e
3 changed files with 14 additions and 2 deletions
|
|
@ -10,5 +10,6 @@ const listener = Deno.listen({ hostname, port });
|
|||
|
||||
console.log(`Listen on ${hostname}:${port}`);
|
||||
for await (const conn of listener) {
|
||||
console.log("Connection initiated");
|
||||
Deno.copy(conn, conn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,16 @@
|
|||
// Library exporting `sayHello` function
|
||||
|
||||
const capitalize = (word: string) =>
|
||||
/**
|
||||
* Title case the given word. First character uppercase and the rest lowercase.
|
||||
* @param {string} word
|
||||
* @returns {string} Capitalized word.
|
||||
*/
|
||||
const capitalize = (word: string): string =>
|
||||
`${word.charAt(0).toUpperCase()}${word.toLowerCase().slice(1)}`;
|
||||
|
||||
export const sayHello = (name: string) => `Hello ${capitalize(name)}`;
|
||||
/**
|
||||
* Greets the named user after name capitalization
|
||||
* @param {string} name
|
||||
* @returns {string} Greeting to the user
|
||||
*/
|
||||
export const sayHello = (name: string): string => `Hello ${capitalize(name)}`;
|
||||
|
|
|
|||
1
index.ts
1
index.ts
|
|
@ -3,6 +3,7 @@ import { serve } from "https://deno.land/std@0.87.0/http/server.ts";
|
|||
const s = serve({ port: 8000 });
|
||||
|
||||
console.log("http://localhost:8000/");
|
||||
|
||||
for await (const req of s) {
|
||||
req.respond({ body: "Hello, World\n" });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue