-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
1 parent
b92d196
commit c5b248e
Showing
17 changed files
with
72 additions
and
80 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 |
---|---|---|
|
@@ -7,7 +7,7 @@ Adapted from the [ExpressJS API Docs](https://expressjs.com/en/4x/api.html). | |
The `app` object conventionally denotes the Opine application. Create it by calling the top-level `opine()` function exported by the Opine module: | ||
|
||
```ts | ||
import opine from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
@@ -59,7 +59,7 @@ The `app.mountpath` property contains one or more path patterns on which a sub-a | |
> A sub-app is an instance of `opine` that may be used for handling the request to a route. | ||
```ts | ||
import opine from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); // the main app | ||
const admin = opine(); // the sub app | ||
|
@@ -447,7 +447,7 @@ app.get("/", function (req, res) { | |
Binds and listens for connections on the specified address. This method is nearly identical to Deno's [http.listenAndServe()](https://doc.deno.land/https/deno.land/std/http/server.ts#listenAndServe). An optional callback can be provided which will be executed after the server starts listening for requests - this is provided for legacy reasons to aid in transitions from Express on Node. | ||
|
||
```ts | ||
import opine from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
@@ -477,7 +477,7 @@ Binds and listens for connections on the specified numerical port. If no port is | |
This method is supported for legacy reasons to aid in transitions from Express on Node. | ||
|
||
```ts | ||
import opine from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
const PORT = 3000; | ||
|
@@ -490,7 +490,7 @@ app.listen(PORT, () => console.log(`Server started on port ${PORT}`)); | |
Binds and listens for connections using the specified [http.HTTPOptions](https://doc.deno.land/https/deno.land/std/http/server.ts#HTTPOptions). This method is nearly identical to Deno's [http.listenAndServe()](https://doc.deno.land/https/deno.land/std/http/server.ts#listenAndServe). An optional callback can be provided which will be executed after the server starts listening for requests - this is provided for legacy reasons to aid in transitions from Express on Node. | ||
|
||
```ts | ||
import opine from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
@@ -502,7 +502,7 @@ app.listen({ port: 3000 }); | |
Binds and listens for connections using the specified [http.HTTPSOptions](https://doc.deno.land/https/deno.land/std/http/server.ts#HTTPSOptions). This method is nearly identical to Deno's [http.listenAndServeTLS()](https://doc.deno.land/https/deno.land/std/http/server.ts#listenAndServeTLS). An optional callback can be provided which will be executed after the server starts listening for requests - this is provided for legacy reasons to aid in transitions from Express on Node. | ||
|
||
```ts | ||
import opine from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ A new `parsedBody` object containing the parsed data is populated on the `reques | |
> As `req.parsedBody`'s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, `req.parsedBody.foo.toString()` may fail in multiple ways, for example `foo` may not be there or may not be a string, and `toString` may not be a function and instead a string or other user-input. | ||
```ts | ||
import { opine, json } from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import { opine, json } from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
@@ -46,7 +46,7 @@ A new `parsedBody` `Buffer` containing the parsed data is populated on the `requ | |
> As `req.parsedBody`'s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, `req.parsedBody.toString()` may fail in multiple ways, for example stacking multiple parsers `req.parsedBody` may be from a different parser. Testing that `req.parsedBody` is a `Buffer` before calling buffer methods is recommended. | ||
```ts | ||
import { opine, raw } from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import { opine, raw } from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
@@ -142,7 +142,7 @@ A new `parsedBody` string containing the parsed data is populated on the `reques | |
> As `req.parsedBody`'s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, `req.parsedBody.trim()` may fail in multiple ways, for example stacking multiple parsers `req.parsedBody` may be from a different parser. Testing that `req.parsedBody` is a string before calling string methods is recommended. | ||
```ts | ||
import { opine, text } from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import { opine, text } from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
@@ -173,7 +173,7 @@ A new `parsedBody` object containing the parsed data is populated on the `reques | |
> As `req.parsedBody`'s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, `req.parsedBody.foo.toString()` may fail in multiple ways, for example `foo` may not be there or may not be a string, and `toString` may not be a function and instead a string or other user-input. | ||
```ts | ||
import { opine, urlencoded } from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import { opine, urlencoded } from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
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 |
---|---|---|
|
@@ -7,15 +7,15 @@ Adapted from the [ExpressJS API Docs](https://expressjs.com/en/4x/api.html). | |
Creates an Opine application. The `opine()` function is a top-level function exported by the Opine module: | ||
|
||
```ts | ||
import opine from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
``` | ||
|
||
The `opine()` function is also exported as a named export: | ||
|
||
```ts | ||
import { opine } from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import { opine } from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
``` |
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 |
---|---|---|
|
@@ -84,7 +84,7 @@ import { | |
opine, | ||
json, | ||
urlencoded, | ||
} from "https://deno.land/x/[email protected].4/mod.ts"; | ||
} from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
@@ -100,7 +100,7 @@ app.post("/profile", function (req, res, next) { | |
The following example shows how to implement your own simple body-parsing middleware to transform `req.parsedBody` into a raw string: | ||
```ts | ||
import opine from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ A router behaves like middleware itself, so you can use it as an argument to [ap | |
Opine has a top-level named function export `Router()` that creates a new `router` object. | ||
|
||
```ts | ||
import { Router } from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import { Router } from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const router = Router(options); | ||
``` | ||
|
@@ -210,7 +210,7 @@ This method is similar to [app.use()](./application#appusepath-callback--callbac | |
Middleware is like a plumbing pipe: requests start at the first middleware function defined and work their way "down" the middleware stack processing for each path they match. | ||
|
||
```ts | ||
import opine, { Router } from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import opine, { Router } from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
const router = Router(); | ||
|
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
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
- uses: actions/checkout@v2 | ||
- uses: denolib/setup-deno@v2 | ||
with: | ||
deno-version: 1.3.1 | ||
deno-version: 1.3.3 | ||
- run: deno install -A -f --unstable -n eggs https://x.nest.land/[email protected]/mod.ts | ||
- run: | | ||
export PATH="/home/runner/.deno/bin:$PATH" | ||
|
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ Fast, minimalist web framework for <a href="https://deno.land/">Deno</a> ported | |
## Getting Started | ||
|
||
```ts | ||
import { opine } from "https://deno.land/x/[email protected].4/mod.ts"; | ||
import { opine } from "https://deno.land/x/[email protected].5/mod.ts"; | ||
|
||
const app = opine(); | ||
|
||
|
@@ -54,13 +54,13 @@ 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/[email protected].4/mod.ts"; | ||
import { opine } from "https://deno.land/x/[email protected].5/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/[email protected].4/mod.ts"; | ||
import { opine } from "https://x.nest.land/[email protected].5/mod.ts"; | ||
``` | ||
|
||
## Features | ||
|
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,27 +6,27 @@ export { | |
Server, | ||
ServerRequest, | ||
Response, | ||
} from "https://deno.land/std@0.66.0/http/server.ts"; | ||
} from "https://deno.land/std@0.68.0/http/server.ts"; | ||
export { | ||
Status, | ||
STATUS_TEXT, | ||
} from "https://deno.land/std@0.66.0/http/http_status.ts"; | ||
} from "https://deno.land/std@0.68.0/http/http_status.ts"; | ||
export { | ||
setCookie, | ||
Cookie, | ||
deleteCookie, | ||
} from "https://deno.land/std@0.66.0/http/cookie.ts"; | ||
} from "https://deno.land/std@0.68.0/http/cookie.ts"; | ||
export { | ||
extname, | ||
fromFileUrl, | ||
basename, | ||
join, | ||
dirname, | ||
resolve, | ||
} from "https://deno.land/std@0.66.0/path/mod.ts"; | ||
export { setImmediate } from "https://deno.land/std@0.66.0/node/timers.ts"; | ||
export { Sha1 } from "https://deno.land/std@0.66.0/hash/sha1.ts"; | ||
export { encoder } from "https://deno.land/std@0.66.0/encoding/utf8.ts"; | ||
} from "https://deno.land/std@0.68.0/path/mod.ts"; | ||
export { setImmediate } from "https://deno.land/std@0.68.0/node/timers.ts"; | ||
export { Sha1 } from "https://deno.land/std@0.68.0/hash/sha1.ts"; | ||
export { encoder } from "https://deno.land/std@0.68.0/encoding/utf8.ts"; | ||
export { | ||
Evt as EventEmitter, | ||
to as getEvent, | ||
|
@@ -35,7 +35,7 @@ export { | |
contentType, | ||
charset, | ||
lookup, | ||
} from "https://deno.land/x/[email protected].5/mod.ts"; | ||
} from "https://deno.land/x/[email protected].6/mod.ts"; | ||
export { createError } from "https://deno.land/x/[email protected]/mod.ts"; | ||
export { Accepts } from "https://deno.land/x/[email protected]/mod.ts"; | ||
export { | ||
|
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 |
---|---|---|
|
@@ -98,7 +98,7 @@ <h2>Table of Contents</h2> | |
<a href="#getting-started" id="getting-started" style="color: inherit; text-decoration: none;"> | ||
<h2>Getting Started</h2> | ||
</a> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { opine } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/[email protected].4/mod.ts"</span>; | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { opine } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/[email protected].5/mod.ts"</span>; | ||
|
||
<span class="hljs-keyword">const</span> app = opine(); | ||
|
||
|
@@ -113,9 +113,9 @@ <h2>Installation</h2> | |
<p>This is a <a href="https://deno.land/">Deno</a> module available to import direct from this repo and via the <a href="https://deno.land/x">Deno Registry</a>.</p> | ||
<p>Before importing, <a href="https://deno.land/#installation">download and install Deno</a>.</p> | ||
<p>You can then import Opine straight into your project:</p> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { opine } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/[email protected].4/mod.ts"</span>;</code></pre> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { opine } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://deno.land/x/[email protected].5/mod.ts"</span>;</code></pre> | ||
<p>Opine is also available on <a href="https://nest.land/package/opine">nest.land</a>, a package registry for Deno on the Blockchain.</p> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { opine } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://x.nest.land/[email protected].4/mod.ts"</span>;</code></pre> | ||
<pre><code class="language-ts"><span class="hljs-keyword">import</span> { opine } <span class="hljs-keyword">from</span> <span class="hljs-string">"https://x.nest.land/[email protected].5/mod.ts"</span>;</code></pre> | ||
<a href="#features" id="features" style="color: inherit; text-decoration: none;"> | ||
<h2>Features</h2> | ||
</a> | ||
|
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
Oops, something went wrong.