Start renaming
This commit is contained in:
@@ -8,7 +8,7 @@ to HTTP requests. These allow the server to indicate which origins (domains,
|
||||
scheme or port) other than its own is permitted to load resources from.
|
||||
|
||||
```ts main.ts
|
||||
import { cors } from "fresh";
|
||||
import { cors } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(cors({
|
||||
@@ -24,5 +24,5 @@ const app = new App()
|
||||
|
||||
## Options
|
||||
|
||||
See the [API docs](https://jsr.io/@fresh/core/doc/~/cors) for a list of all
|
||||
See the [API docs](https://jsr.io/@paulaboks/sweet/doc/~/cors) for a list of all
|
||||
supported options
|
||||
|
||||
@@ -7,7 +7,7 @@ The `csp()` middleware can be used to add
|
||||
to HTTP requests. These restrict which resources a document is allowed to load.
|
||||
|
||||
```ts main.ts
|
||||
import { csp } from "fresh";
|
||||
import { csp } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(csp({
|
||||
@@ -32,7 +32,7 @@ This ensures only inline `<script>` and `<style>` tags rendered by Fresh are
|
||||
allowed to execute.
|
||||
|
||||
```ts main.ts
|
||||
import { csp } from "fresh";
|
||||
import { csp } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(csp({ useNonce: true }))
|
||||
@@ -70,5 +70,5 @@ When `useNonce` is enabled:
|
||||
|
||||
## Options
|
||||
|
||||
See the [API docs](https://jsr.io/@fresh/core/doc/~/csp) for a list of all
|
||||
See the [API docs](https://jsr.io/@paulaboks/sweet/doc/~/csp) for a list of all
|
||||
supported options.
|
||||
|
||||
@@ -12,7 +12,7 @@ and
|
||||
headers. Requests from untrusted origins are rejected.
|
||||
|
||||
```ts main.ts
|
||||
import { App, csrf } from "fresh";
|
||||
import { App, csrf } from "sweet";
|
||||
|
||||
const app = new App();
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ Since Fresh plugins are just middlewares and route handlers, creating a reusable
|
||||
plugin is as simple as exporting a function that returns a middleware:
|
||||
|
||||
```ts plugins/request-id.ts
|
||||
import type { MiddlewareFn } from "fresh";
|
||||
import type { MiddlewareFn } from "sweet";
|
||||
|
||||
export function requestId(): MiddlewareFn<{ requestId: string }> {
|
||||
return async (ctx) => {
|
||||
@@ -41,7 +41,7 @@ export function requestId(): MiddlewareFn<{ requestId: string }> {
|
||||
```
|
||||
|
||||
```ts main.ts
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import { requestId } from "./plugins/request-id.ts";
|
||||
|
||||
const app = new App()
|
||||
|
||||
@@ -7,7 +7,7 @@ It supports deny lists, allow lists, and CIDR subnet matching. Deny rules always
|
||||
take precedence over allow rules.
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
@@ -23,7 +23,7 @@ Block specific IPs or subnets. Any request from a matching address receives a
|
||||
403 Forbidden response:
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
@@ -37,7 +37,7 @@ When an allow list is provided, only matching IPs are permitted. All other
|
||||
addresses are blocked:
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
@@ -51,7 +51,7 @@ When both lists are provided, deny rules are checked first. An IP that appears
|
||||
in both lists is blocked:
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
@@ -68,7 +68,7 @@ By default, blocked requests receive a `403 Forbidden` response. Use the
|
||||
`onBlocked` callback to customize this:
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
|
||||
@@ -7,7 +7,7 @@ end with a slash character or will never end with one. It redirects the user's
|
||||
request respectively.
|
||||
|
||||
```ts main.ts
|
||||
import { trailingSlashes } from "fresh";
|
||||
import { trailingSlashes } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(trailingSlashes("never"))
|
||||
@@ -17,7 +17,7 @@ const app = new App()
|
||||
Always append a trailing slash:
|
||||
|
||||
```ts main.ts
|
||||
import { trailingSlashes } from "fresh";
|
||||
import { trailingSlashes } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(trailingSlashes("always"))
|
||||
|
||||
Reference in New Issue
Block a user