DiamondDragon
DiamondDragon4w ago

HTTP Path Suffix Not Working?

Now it is almost midnight for me so I could have missed something, but I'm not able to get HTTP routes like https:CONVEX_URL.site/route/$params Am i doing something wrong? I get the Response No matching routes found The docs: https://docs.convex.dev/functions/http-actions#defining-http-actions
// Define a route using a path prefix (typo - should be suffix)

http.route({
// Will match /getAuthorMessages/User+123 and /getAuthorMessages/User+234 etc.
pathPrefix: "/getAuthorMessages/",
method: "GET",
handler: getByAuthorPathSuffix,
});
// Define a route using a path prefix (typo - should be suffix)

http.route({
// Will match /getAuthorMessages/User+123 and /getAuthorMessages/User+234 etc.
pathPrefix: "/getAuthorMessages/",
method: "GET",
handler: getByAuthorPathSuffix,
});
My suggestion would be for an explicit path param definition like https://hono.dev/docs/api/routing#path-parameter
Routing - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
HTTP Actions | Convex Developer Hub
HTTP actions allow you to build an HTTP API right in Convex!
No description
5 Replies
DiamondDragon
DiamondDragonOP4w ago
I am seeing it deployed
No description
ampp
ampp4w ago
In your code you still have path: , change it to pathPrefix:
lee
lee4w ago
+1 to using pathPrefix. And if you want explicit path params, use Hono https://stack.convex.dev/hono-with-convex
Advanced HTTP Endpoints: Convex ❤️ Hono
Adding advanced HTTP Endpoint functionality by extending Convex with Hono.
DiamondDragon
DiamondDragonOP4w ago
Ahhhh dang. And that’s why sleep is important lol . Totally missed the property key. Thanks @lee as well. Good to know about hono integration Curious if it’s possible to use the hono rpc client with honoconvex as well
lee
lee4w ago
if you're looking to use structured RPCs, we recommend using convex queries/mutations/actions and some convex client (like https://docs.convex.dev/api/classes/browser.ConvexHttpClient ) which will give you typesafety, argument validation, etc. I'm not familiar with the hono rpc client, but i don't see why it wouldn't work

Did you find this page helpful?