https://github.com/keirany/echo-middleware
https://github.com/keirany/echo-middleware
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/keirany/echo-middleware
- Owner: KeiranY
- Created: 2020-11-28T02:55:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-30T21:37:52.000Z (over 4 years ago)
- Last Synced: 2025-03-10T07:05:41.137Z (3 months ago)
- Language: JavaScript
- Size: 71.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# echo-middleware
[](https://www.npmjs.com/package/echo-middleware)
[](https://github.com/KcYoung1997/echo-middleware/actions?query=workflow%3A%22Node.js+CI%2FTest%22)Echos back the content recieved in a web request.
## Install
```bash
npm i echo-middleware
```## Usage/Compatibility
The servers below have been tested for compatibility and have [examples](https://github.com/KcYoung1997/echo-middleware/tree/master/examples):
- [connect](https://www.npmjs.com/package/connect) ([example](https://github.com/KcYoung1997/echo-middleware/blob/master/examples/connect/index.js))
- [express](https://www.npmjs.com/package/express) ([example](https://github.com/KcYoung1997/echo-middleware/blob/master/examples/express/index.js))
- [koa](https://www.npmjs.com/package/koa) ([example](https://github.com/KcYoung1997/echo-middleware/blob/master/examples/koa/index.js))## Example
Below example shows the request headers and response body from a request made to the [connect example](https://github.com/KcYoung1997/echo-middleware/blob/master/examples/connect/index.js) server, using [HTTPie](https://httpie.io/).
```bash
$ http -p Hb localhost:8080/echo
GET /echo HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8080
User-Agent: HTTPie/2.3.0GET /echo HTTP/1.1
host: localhost:8080
user-agent: HTTPie/2.3.0
accept-encoding: gzip, deflate
accept: */*
connection: keep-alive
```## Tests
Run the test suite:
```bash
# Clean install dependencies
npm ci# Run tests
npm test
```