ZuploZuplo
LoginSign Up
  • Documentation
  • API Reference
Introduction
Getting Started
    Develop using the Portal
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingMCP - Quick start
    Develop Locally
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth
Concepts
Development
Policies
Handlers
API Keys
MCP Server
MCP Gateway
AI Gateway
Developer Portal
Monetization
Deploying & Source Control
Observability
Networking & Infrastructure
Account Management
Programming API
    Overview
    Request & Context
    Configuration
    Caching APIs
    Data Management
    Extensions & Hooks
    Error Handling
    Logging & Observability
    Types and Interfaces
    Web Standards
    Advanced Topics
      Node ModulesCode ReuseRoute Custom DataClone Request/ResponseRuntime Behaviorszp-body-removedZuplo Identity TokenJWT Service PluginOAuth Protected Resource Plugin
Build with AI
Zuplo CLI
Migration Guides
Platform LimitsSecuritySupportTrust & ComplianceChangelog
powered by Zudoku
Advanced Topics

Share code across request handlers and policies with modules

Sharing code across your request handlers and policies is easy with modules. Simply create a new module with exports and import them to your other files. Here's a module called util.ts:

Code
//util.ts export function increment(n: number) { return n + 1; }

Now in our request handler, we can import this and reuse this code

Code
import { ZuploRequest, ZuploContext } from "@zuplo/runtime"; import { increment } from "./util"; export default async function (request: ZuploRequest, context: ZuploContext) { return increment(1); }
Edit this page
Last modified on August 8, 2025
Node ModulesRoute Custom Data
TypeScript
TypeScript