From a10a41f1004b1ee63d7b5f2604e5a6b2a5b01bd5 Mon Sep 17 00:00:00 2001
From: Craig Morten
- + @@ -41,7 +41,7 @@ Fast, minimalist web framework for Deno ported ## Getting Started ```ts -import { opine } from "https://deno.land/x/opine@2.0.0/mod.ts"; +import { opine } from "https://deno.land/x/opine@2.0.1/mod.ts"; const app = opine(); @@ -65,14 +65,14 @@ Before importing, [download and install Deno](https://deno.land/#installation). You can then import Opine straight into your project: ```ts -import { opine } from "https://deno.land/x/opine@2.0.0/mod.ts"; +import { opine } from "https://deno.land/x/opine@2.0.1/mod.ts"; ``` Opine is also available on [nest.land](https://nest.land/package/opine), a package registry for Deno on the Blockchain. ```ts -import { opine } from "https://x.nest.land/opine@2.0.0/mod.ts"; +import { opine } from "https://x.nest.land/opine@2.0.1/mod.ts"; ``` ## Features diff --git a/deps.ts b/deps.ts index a30ed60c..699ab97f 100644 --- a/deps.ts +++ b/deps.ts @@ -1,14 +1,14 @@ -export { Server } from "https://deno.land/std@0.116.0/http/server.ts"; -export type { ConnInfo } from "https://deno.land/std@0.116.0/http/server.ts"; +export { Server } from "https://deno.land/std@0.119.0/http/server.ts"; +export type { ConnInfo } from "https://deno.land/std@0.119.0/http/server.ts"; export { Status, STATUS_TEXT, -} from "https://deno.land/std@0.116.0/http/http_status.ts"; +} from "https://deno.land/std@0.119.0/http/http_status.ts"; export { deleteCookie, setCookie, -} from "https://deno.land/std@0.116.0/http/cookie.ts"; -export type { Cookie } from "https://deno.land/std@0.116.0/http/cookie.ts"; +} from "https://deno.land/std@0.119.0/http/cookie.ts"; +export type { Cookie } from "https://deno.land/std@0.119.0/http/cookie.ts"; export { basename, dirname, @@ -19,15 +19,15 @@ export { normalize, resolve, sep, -} from "https://deno.land/std@0.116.0/path/mod.ts"; -export { setImmediate } from "https://deno.land/std@0.116.0/node/timers.ts"; -export { parse } from "https://deno.land/std@0.116.0/node/querystring.ts"; -export { default as EventEmitter } from "https://deno.land/std@0.116.0/node/events.ts"; -export { Sha1 } from "https://deno.land/std@0.116.0/hash/sha1.ts"; +} from "https://deno.land/std@0.119.0/path/mod.ts"; +export { setImmediate } from "https://deno.land/std@0.119.0/node/timers.ts"; +export { parse } from "https://deno.land/std@0.119.0/node/querystring.ts"; +export { default as EventEmitter } from "https://deno.land/std@0.119.0/node/events.ts"; +export { Sha1 } from "https://deno.land/std@0.119.0/hash/sha1.ts"; export { readableStreamFromReader, readerFromStreamReader, -} from "https://deno.land/std@0.116.0/streams/conversion.ts"; +} from "https://deno.land/std@0.119.0/streams/conversion.ts"; export { charset, @@ -46,6 +46,6 @@ export { encodeUrl } from "https://deno.land/x/encodeurl@1.0.0/mod.ts"; export { gunzip, inflate } from "https://deno.land/x/compress@v0.4.1/mod.ts"; export { default as parseRange } from "https://cdn.skypack.dev/range-parser@1.2.1?dts"; -export { default as qs } from "https://cdn.skypack.dev/qs@6.10.1?dts"; +export { default as qs } from "https://cdn.skypack.dev/qs@6.10.2?dts"; export { default as ipaddr } from "https://cdn.skypack.dev/ipaddr.js@2.0.1?dts"; export { default as ms } from "https://cdn.skypack.dev/ms@2.1.3?dts"; diff --git a/docs/index.html b/docs/index.html index 3e499e88..d7123b8f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -82,7 +82,7 @@
import { opine } from "https://deno.land/x/opine@2.0.0/mod.ts";
+ import { opine } from "https://deno.land/x/opine@2.0.1/mod.ts";
const app = opine();
@@ -125,11 +125,11 @@ Installation
repo and via the Deno Registry.
Before importing, download and install Deno.
You can then import Opine straight into your project:
- import { opine } from "https://deno.land/x/opine@2.0.0/mod.ts";
+ import { opine } from "https://deno.land/x/opine@2.0.1/mod.ts";
Opine is also available on nest.land, a
package registry for Deno on the Blockchain.
- import { opine } from "https://x.nest.land/opine@2.0.0/mod.ts";
+ import { opine } from "https://x.nest.land/opine@2.0.1/mod.ts";
Features
diff --git a/egg.json b/egg.json
index 4b6f9de1..f53584ba 100644
--- a/egg.json
+++ b/egg.json
@@ -1,7 +1,7 @@
{
"name": "opine",
"description": "Fast, minimalist web framework for Deno ported from ExpressJS.",
- "version": "2.0.0",
+ "version": "2.0.1",
"repository": "https://github.com/asos-craigmorten/opine",
"stable": true,
"checkFormat": false,
diff --git a/src/application.ts b/src/application.ts
index d90759d0..ecfffa16 100644
--- a/src/application.ts
+++ b/src/application.ts
@@ -551,22 +551,25 @@ app.listen = function listen(
options?: number | string | HTTPOptions | HTTPSOptions,
callback?: () => void,
): Server {
- let addr: string;
+ let port = 0;
+ let hostname = "";
- if (typeof options === "undefined") {
- addr = ":0";
- } else if (typeof options === "number") {
- addr = `:${options}`;
+ if (typeof options === "number") {
+ port = options;
} else if (typeof options === "string") {
- addr = options;
+ const addr = options.split(":");
+ hostname = addr[0];
+ port = parseInt(addr[1]);
} else {
- addr = `${options.hostname ?? ""}:${options.port ?? 0}`;
+ hostname = options?.hostname ?? "";
+ port = options?.port ?? 0;
}
const isTls = isTlsOptions(options);
const server = new Server({
- addr,
+ port,
+ hostname,
handler: async (request, connInfo) => {
const opineRequest = new WrappedRequest(request, connInfo);
this(opineRequest);
diff --git a/src/utils/finalHandler.ts b/src/utils/finalHandler.ts
index 87462c17..82d08410 100644
--- a/src/utils/finalHandler.ts
+++ b/src/utils/finalHandler.ts
@@ -183,7 +183,7 @@ function getErrorStatusCode(err: any): number | undefined {
function getResourceName(req: OpineRequest): string {
try {
return (parseUrl(req) as ParsedURL).pathname;
- } catch (e) {
+ } catch {
return "resource";
}
}
diff --git a/test/deps.ts b/test/deps.ts
index aadf198c..337fcdad 100644
--- a/test/deps.ts
+++ b/test/deps.ts
@@ -1,8 +1,8 @@
-export { deferred } from "https://deno.land/std@0.116.0/async/deferred.ts";
-export type { Deferred } from "https://deno.land/std@0.116.0/async/deferred.ts";
+export { deferred } from "https://deno.land/std@0.119.0/async/deferred.ts";
+export type { Deferred } from "https://deno.land/std@0.119.0/async/deferred.ts";
export { expect, mock } from "https://deno.land/x/expect@v0.2.9/mod.ts";
-export { superdeno } from "https://deno.land/x/superdeno@4.6.1/mod.ts";
+export { superdeno } from "https://deno.land/x/superdeno@4.7.1/mod.ts";
export type {
IRequest as SuperDenoRequest,
IResponse as SuperDenoResponse,
-} from "https://deno.land/x/superdeno@4.6.1/mod.ts";
+} from "https://deno.land/x/superdeno@4.7.1/mod.ts";
diff --git a/version.ts b/version.ts
index 63b4dd96..d2b941f4 100644
--- a/version.ts
+++ b/version.ts
@@ -1,9 +1,9 @@
/**
* Version of Opine.
*/
-export const VERSION = "2.0.0";
+export const VERSION = "2.0.1";
/**
* Supported version of Deno.
*/
-export const DENO_SUPPORTED_VERSIONS: string[] = ["1.16.3"];
+export const DENO_SUPPORTED_VERSIONS: string[] = ["1.17.1"];