© 2026 Hedgehog Software, LLC
curl -v http://localhost:3000/api/
main.wasp
apiNamespace api { middlewareConfigFn: import { apiKeyAuthMiddlewareConfigFn } from "@src/server/middlewares/apiKeyAuth", path: "/api" }
middleware (apiKeyAuth.ts)
export const apiKeyAuthMiddlewareConfigFn = (middlewareConfig: Map<string, any>) => { middlewareConfig.set('custom.middleware', (_req, _res, next) => { console.log('Middleware triggered') next() }) return middlewareConfig }
curl response
* Host localhost:3000 was resolved. * IPv6: ::1 * IPv4: 127.0.0.1 * Trying [::1]:3000... * connect to ::1 port 3000 from ::1 port 50864 failed: Connection refused * Trying 127.0.0.1:3000... * Connected to localhost (127.0.0.1) port 3000 > GET /api/ HTTP/1.1 > Host: localhost:3000 > User-Agent: curl/8.6.0 > Accept: */* > < HTTP/1.1 200 OK < Vary: Origin < Content-Type: text/html < Cache-Control: no-cache < Etag: W/"84f-lZ8MJ+JUtmxxiomsdNc0g0Rg40I" < Date: Wed, 05 Feb 2025 22:22:37 GMT < Connection: keep-alive < Keep-Alive: timeout=5 < Content-Length: 2127 < <!DOCTYPE html> <html lang="en"> <head> <script type="module">