use deps.ts

This commit is contained in:
Ruidy 2021-02-19 17:22:21 +01:00
parent 78d7597c76
commit 17377d6a98
7 changed files with 15 additions and 6 deletions

View file

2
cli.ts
View file

@ -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";
const start = async () => {

7
deps.ts Normal file
View 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";

View file

@ -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;
console.log(`Server listening on http://localhost:${port}/`);
await listenAndServe({ port }, (req) => req.respond({ body: "Hello" }));
// write handler using req.url

View file

@ -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";
Deno.test("Get locale by id", () => {

View file

@ -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 { ID } from "./id.ts";

View file

@ -1,6 +1,6 @@
import { assertStrictEquals } from "https://deno.land/std@0.87.0/testing/asserts.ts";
import { sayHello, sayRandomHello } from "./hello.ts";
import { assertStrictEquals } from "../../deps.ts";
import { ID } from "../types/id.ts";
import { sayHello, sayRandomHello } from "./hello.ts";
Deno.test("Random Hello", () => {
const result = sayRandomHello();