-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📚 Doc: Update intro.md Static Files section #3303
Conversation
In v3 the apps Static method has been removed and its functionality has been moved to the static middleware. The given code example has been updated accordingly.
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
WalkthroughThe documentation for Fiber was updated to change the recommended approach for serving static files. The direct method using app.Static("/", "./public") was replaced with a middleware approach using app.Use("/", static.New("./public")). The intro now clearly recommends the static middleware, reflecting an update in best practices for the Fiber framework. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant A as Fiber App
participant M as Static Middleware
participant FS as File System
C->>A: Request static resource
A->>M: Pass request via middleware
M->>FS: Fetch file from "./public"
FS-->>M: Return file data
M-->>A: Deliver file content
A-->>C: Serve static content
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/intro.md (1)
181-181
: Middleware Usage Update
The updated invocation "app.Use("/", static.New("./public"))" properly replaces the deprecated app.Static method according to Fiber v3 guidelines. This change accurately reflects the recommended practice for serving static files. Consider adding a brief note about customizable options for static.New() if your documentation targets more advanced configurations.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/intro.md
(2 hunks)
🔇 Additional comments (2)
docs/intro.md (2)
166-166
: Static Files Section Documentation Update
The revised sentence now directs users to employ the static middleware for serving static files, aligning with Fiber v3 changes. Please verify that the linked static middleware page is updated and provides the necessary context for users.
175-175
: Import Addition for Static Middleware
The addition of the import "github.com/gofiber/fiber/v3/middleware/static" is correct and essential for the new static file serving approach. This ensures that the static middleware is available in the code snippets.
Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Description
In v3 the apps Static method has been removed and its functionality has been moved to the static middleware.
Fixes # (issue)
The given code example has been updated accordingly.
Changes introduced
List the new features or adjustments introduced in this pull request. Provide details on benchmarks, documentation updates, changelog entries, and if applicable, the migration guide.
Type of change
Please delete options that are not relevant.
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/
directory for Fiber's documentation.Commit formatting
Please use emojis in commit messages for an easy way to identify the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md