Skip to content

Examples

Examples

GitHub Repository

Full examples are available in the ContractShield repository:

Terminal window
git clone https://github.com/zeekmartin/contractshield
cd contractshield/examples

Available Examples

ExampleDescription
express-basicBasic Express.js setup
fastify-webhooksFastify with Stripe webhooks
sidecar-javaJava app with sidecar
kubernetesFull Kubernetes deployment

Express Basic

import express from 'express';
import { contractshield } from '@cshield/pep-express';
const app = express();
app.use(express.json());
app.use(contractshield({ policy: './policy.yaml' }));
app.post('/api/orders', (req, res) => {
res.json({ orderId: crypto.randomUUID() });
});
app.listen(3000);