Skip to content

[example] Add Request Deduplication demo to Express example #29

Description

@AryanSharma48

Problem

The Express example currently demonstrates features such as retries and
the circuit breaker, but does not demonstrate SmoothAPI's Request
Deduplication functionality.

Request Deduplication is an important feature and would be useful to show
in a runnable example.

What needs to be done

Add a new /dedup-demo endpoint to the Express example.

The endpoint should:

  1. Create a SmoothAPI client with request deduplication enabled
  2. Make multiple identical requests concurrently
  3. Use Promise.all() to trigger the requests
  4. Return the results to the client

The goal is to demonstrate that multiple concurrent identical requests
can be deduplicated.

Acceptance Criteria

  • A /dedup-demo endpoint exists
  • The endpoint uses SmoothAPI request deduplication
  • Multiple requests are initiated concurrently
  • Promise.all() is used appropriately
  • The endpoint returns the results
  • The existing Express examples continue to work

Files to look at

  • examples/express/server.ts
  • SmoothAPI request deduplication implementation/documentation

Prerequisites

Basic TypeScript/JavaScript, Express and Promises.

Notes

The goal is to demonstrate the feature clearly rather than build a
complex application.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions