mirror of
https://github.com/rjNemo/deno_hello
synced 2026-06-12 12:56:38 +00:00
use deps.ts
This commit is contained in:
parent
78d7597c76
commit
17377d6a98
7 changed files with 15 additions and 6 deletions
0
src/.gitignore → .gitignore
vendored
0
src/.gitignore → .gitignore
vendored
2
cli.ts
2
cli.ts
|
|
@ -1,4 +1,4 @@
|
||||||
import { readLines } from "https://deno.land/std@0.87.0/io/bufio.ts";
|
import { readLines } from "./deps.ts";
|
||||||
import { ID, sayHello, sayRandomHello, ValidationError } from "./src/index.ts";
|
import { ID, sayHello, sayRandomHello, ValidationError } from "./src/index.ts";
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
|
|
|
||||||
7
deps.ts
Normal file
7
deps.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
export {
|
||||||
|
assert,
|
||||||
|
assertStrictEquals,
|
||||||
|
assertThrows,
|
||||||
|
} from "https://deno.land/std@0.87.0/testing/asserts.ts";
|
||||||
|
export { readLines } from "https://deno.land/std@0.87.0/io/bufio.ts";
|
||||||
|
export { listenAndServe } from "https://deno.land/std@0.87.0/http/server.ts";
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { listenAndServe } from "https://deno.land/std@0.87.0/http/server.ts";
|
import { listenAndServe } from "./deps.ts";
|
||||||
|
|
||||||
const port = 8000;
|
const port = 8000;
|
||||||
|
|
||||||
console.log(`Server listening on http://localhost:${port}/`);
|
console.log(`Server listening on http://localhost:${port}/`);
|
||||||
await listenAndServe({ port }, (req) => req.respond({ body: "Hello" }));
|
await listenAndServe({ port }, (req) => req.respond({ body: "Hello" }));
|
||||||
|
|
||||||
|
// write handler using req.url
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { assertStrictEquals } from "https://deno.land/std@0.87.0/testing/asserts.ts";
|
import { assertStrictEquals } from "../../deps.ts";
|
||||||
import { getLocaleById } from "./locales.ts";
|
import { getLocaleById } from "./locales.ts";
|
||||||
|
|
||||||
Deno.test("Get locale by id", () => {
|
Deno.test("Get locale by id", () => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { assertThrows } from "https://deno.land/std@0.87.0/testing/asserts.ts";
|
import { assertThrows } from "../../deps.ts";
|
||||||
import { ValidationError } from "../errors/exceptions.ts";
|
import { ValidationError } from "../errors/exceptions.ts";
|
||||||
import { ID } from "./id.ts";
|
import { ID } from "./id.ts";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { assertStrictEquals } from "https://deno.land/std@0.87.0/testing/asserts.ts";
|
import { assertStrictEquals } from "../../deps.ts";
|
||||||
import { sayHello, sayRandomHello } from "./hello.ts";
|
|
||||||
import { ID } from "../types/id.ts";
|
import { ID } from "../types/id.ts";
|
||||||
|
import { sayHello, sayRandomHello } from "./hello.ts";
|
||||||
|
|
||||||
Deno.test("Random Hello", () => {
|
Deno.test("Random Hello", () => {
|
||||||
const result = sayRandomHello();
|
const result = sayRandomHello();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue