https 404 not found
import { httpRouter } from 'convex/server'
import { httpAction } from './_generated/server'
const http = httpRouter()
http.route({
path: '/test',
method: 'GET',
handler: httpAction(async (ctx, request) => {
try {
const resll = await request.json()
console.log(resll)
// const data = await ctx.runMutation(internal.user.register, body)
// console.log(data)
return new Response(null, {
status: 200,
})
} catch (err) {
console.error(err)
return new Response('something went wrong', {
status: 400,
})
}
}),
})
------------------------------------------------------
Status
404
VersionHTTP/2
Transferred191 B (58 B size)
Referrer Policystrict-origin-when-cross-origin
Request PriorityHighest
DNS ResolutionSystem
5 Replies
What URL are you requesting?
What file is this code in?
is it possible you're missing the line
export default http;
?import { httpRouter } from 'convex/server'
import { httpAction } from './_generated/server'
const http = httpRouter()
export const test = http.route({
path: '/test',
method: 'GET',
handler: httpAction(async (ctx, request) => {
try {
const resll = await request.json()
console.log(resll)
// const data = await ctx.runMutation(internal.user.register, body)
// console.log(data)
return new Response(null, {
status: 200,
})
} catch (err) {
console.error(err)
return new Response('something went wrong', {
status: 400,
})
}
}),
})
added export and tested same problem
const response = await fetch(
https://${CONVEX_DEPLOYMENT_URL}.convex.site/test
)
fetch calling from client side
iam doing export const test = code
code is in the "https.ts" fileMove it to http.ts
and default export the router,
export default http
ok, i got it, thank you