node-file-router icon indicating copy to clipboard operation
node-file-router copied to clipboard

[Snyk] Upgrade node-file-router from 0.6.0 to 0.7.0

Open Danilqa opened this issue 10 months ago • 1 comments

snyk-top-banner

Snyk has created this PR to upgrade node-file-router from 0.6.0 to 0.7.0.

:information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


  • The recommended version is 1 version ahead of your current version.

  • The recommended version was released a month ago.

Release notes
Package name: node-file-router
  • 0.7.0 - 2025-01-25

    What's new

    Features

    Now, node-file-router supports classes. The main requirement is that it should be the default export.

    export default class Resource { get(req, res, routeParams) { const { documentId, draftId } = routeParams; res.end(Requested document <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">documentId</span><span class="pl-kos">}</span></span> and his draft <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">draftId</span><span class="pl-kos">}</span></span>); }

    post(req, res, routeParams) { const { documentId, draftId } = routeParams; res.end(Created draft <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">draftId</span><span class="pl-kos">}</span></span> for document <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">documentId</span><span class="pl-kos">}</span></span>); }

    patch(req, res, routeParams) { // ... } }

    Alternatively, you can export a class instance:

    class SomeResource { get(req, res, routeParams) { // ... } }

    export default new SomeResource();

  • 0.6.0 - 2024-02-24

    What's new

    Features

    Added the ability to modify or override a final result in middlewares (#41).

    For example, you can now set response headers in Bun inside middlewares:

    import type { NextFunction } from 'node-file-router';

    export async function useCors(req: Request, next: NextFunction<Response>) { const res = await next();

    res.headers.set('Access-Control-Allow-Methods', 'PUT, POST, OPTIONS, HEAD');

    return res; }

    Documentation

from node-file-router GitHub release notes

[!IMPORTANT]

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

Danilqa avatar Feb 20 '25 02:02 Danilqa

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
node-file-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 2:17am

vercel[bot] avatar Feb 20 '25 02:02 vercel[bot]