JSPM

express-curl

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 50
  • Score
    100M100P100Q74480F
  • License ISC

Print equivalent curl of express requests

Package Exports

  • express-curl

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-curl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

express-curl

Simple but effective, this ExpressJS middleware prints out the equivalent curl command. Typically this would be used as a utility for backend developers for replicating requests that may be causing problems.

Installation

Install the package by running the command below, from the root of your NodeJS project.

npm install --save express-curl

Usage

  1. Include the package in your ExpressJS app along with other dependencies.
const fs = require('fs');
const express = require('express');

// Include express-curl as a dependency
const expressCurl = require('express-curl);

let app = express();
...
  1. Declare this as a middleware just above the route definitions
app.use(bodyParser.json());
app.use(multiplart());
...

// Include the express curl middleware
app.use(expressCurl);

...
app.use('/auth', authRouter);
app.use('/users', usersRouter);

Now the stdout will print the curl.

Alt text