@scalar/echo-server
TypeScript icon, indicating that this package has built-in type declarations

0.6.4 • Public • Published

Scalar Echo Server

Version Downloads License Discord

The Scalar Echo Server is an Express server, which replies with the request data. Works well with the Scalar API Client.

Installation

npm install @scalar/echo-server

Usage

Create a new Node.js project and run the following code to run your own instance:

import { createEchoServer } from '@scalar/echo-server'

const { listen } = createEchoServer()

listen(5052, () => {
  console.log(`🔁 Echo Server listening on http://localhost:5052`)
})

Example

No matter which route you hit, the response contains all the request data and looks like that:

{
  "headers": {
    "host": "localhost:5052",
    "connection": "keep-alive",
    "accept": "*/*",
    "accept-language": "*",
    "sec-fetch-mode": "no-cors",
    "user-agent": "undici",
    "cache-control": "max-age=0",
    "accept-encoding": "gzip, deflate",
    "content-length": "0"
  },
  "cookies": {},
  "method": "GET",
  "path": "/foo",
  "query": {
    "foo": "bar"
  },
  "body": {}
}

Readme

Keywords

Package Sidebar

Install

npm i @scalar/echo-server

Weekly Downloads

1

Version

0.6.4

License

MIT

Unpacked Size

9.63 kB

Total Files

10

Last publish

Collaborators

  • amritkahlon
  • scalar_geoff
  • mason-little
  • hwkr
  • tommastro
  • cameronrohani
  • hanspagel
  • marclave