National Pest Management

    fastify-method-override

    1.5.9 • Public • Published

    fastify-method-override

    github action status Codacy Badge test coverage npm version

    Plugin for Fastify, which allows use HTTP verbs, such as DELETE, PATCH, HEAD, PUT, OPTIONS in case the client doesn't support them. Supports Fastify versions >=2.0.0.

    Install

    $ npm install fastify-method-override

    Usage

    import fastify from 'fastify';
    import fastifyMethodOverride from 'fastify-method-override';
    
    const app = fastify();
    
    app.register(fastifyMethodOverride);

    To override the HTTP method, use the HTML form with the hidden _method field and the value of the target method:

    <form method="POST" action="/url">
      <input type="hidden" name="_method" value="DELETE">
      <input type="submit" value="Submit">
    </form>

    Note

    If you use setNotFoundHandler, the plugin may not work correctly. In order to override the standard 404 error handler, you must use setErrorHandler.

    If you are having trouble using the plugin, you can use the fastify-method-override-wrapper library.

    Install

    npm i fastify-method-override

    DownloadsWeekly Downloads

    187

    Version

    1.5.9

    License

    MIT

    Unpacked Size

    8.4 kB

    Total Files

    4

    Last publish

    Collaborators

    • corsicanec82