Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/en/guide/features/cors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ CORS implements cross-origin access control through a series of HTTP headers:
Since the browser sends preflight requests with `Method::OPTIONS`, it is necessary to handle such requests. The CORS middleware must be added to the `Service`.

## Using CORS in Salvo
{/* add cors in Salvo with cargo */}
:::info
this is how to install cors in Salvo
```rust
cargo add salvo --features cors
```
:::

Salvo provides built-in CORS middleware that can be easily configured and used. Here is an example code snippet:

Expand Down
7 changes: 7 additions & 0 deletions docs/en/guide/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ Create a new project:
cargo new hello --bin
```

:::details
How to install Salvo
```bash
cargo add salvo
```
:::

Add dependencies to `Cargo.toml`:

```toml file="<root>/codes/hello/Cargo.toml"
Expand Down
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,30 @@
"build": "rspress build",
"dev": "rspress dev",
"format": "prettier --write .",
"preview": "rspress preview"
"preview": "rspress preview",
"test": "rstest",
"test:browser": "rstest --config=rstest.browser.config.mts"
},
"devDependencies": {
"@google/genai": "^1.34.0",
"openai": "^6.15.0",
"@rspress/core": "2.0.2",
"@rspress/plugin-llms": "2.0.2",
"@rspress/plugin-preview": "2.0.2",
"@rspress/plugin-sitemap": "2.0.2",
"@rspress/plugin-twoslash": "2.0.2",
"@rstest/browser-react": "^0.9.7",
"@rstest/core": "^0.9.7",
"@testing-library/react": "^16.3.2",
"@types/node": "^24.10.4",
"prettier": "^3.7.4",
"@types/react": "^19.2.7",
"openai": "^6.15.0",
"prettier": "^3.7.4",
"react": "^19.2.3",
"react-dom": "^19.2.3",
"rsbuild-plugin-google-analytics": "^1.0.5",
"rsbuild-plugin-open-graph": "^1.1.2"
"rsbuild-plugin-open-graph": "^1.1.2",
"@rstest/browser": "^0.9.7",
"@testing-library/dom": "^10.0.0",
"playwright": "^1.49.1"
}
}
Loading