z402/examples/basic-express
bberkayozdemir faed410188 release
2025-11-11 19:31:01 +03:00
..
2025-11-11 19:31:01 +03:00
2025-11-11 19:31:01 +03:00
2025-11-11 19:31:01 +03:00
2025-11-11 19:31:01 +03:00
2025-11-11 19:31:01 +03:00

Example: Basic Express Usage (No Database)

This example demonstrates the simplest possible z402 setup.

  • Uses z402/express middleware
  • Requires payment before returning protected content
  • Does not use a database, so payments are processed directly when submitted
  • Intended for testing, prototyping, and learning

This mode is crash-unsafe:

  • If the server restarts during payment finalization, the payment may not be retried.
  • Use a storage backend (SQLite / Postgres / LibSQL) for production-grade reliability.

Run:

npm start