Skip to content

Latest commit

 

History

History
67 lines (61 loc) · 1.29 KB

HALLUCINATIONS.md

File metadata and controls

67 lines (61 loc) · 1.29 KB

hallucinated wrong ".private()" method for internal functions

hallucinated "convex/schema" import

import { defineSchema, defineTable } from "convex/schema";
import { v } from "convex/values";

export default defineSchema({
  users: defineTable({
    name: v.string(),
  }),
  
  messages: defineTable({
    text: v.string(),
    authorName: v.string(),
  }),
});

forgot to use httpAction

http.route({
  path: "/api/hello",
  method: "GET",
  handler: async (ctx) => {
    return new Response("there", {
      status: 200,
      headers: {
        "Content-Type": "text/plain",
      },
    });
  },
});

also creating handler at http.config.ts??

http.route({
  path: "/api/hello",
  method: "GET",
  handler: hello.handleGet,
});

// Route for /api/messages/*
http.route({
  path: "/api/messages/*",
  method: "POST",
  handler: messages.handlePost,
});

and then pulling out the handler into separate files and hallucinating types.

export const hello = {
  handleGet: async (request: Http.Request) => {
    // Get the request body as text
    const bodyText = await request.text();
    
    // Return the concatenated response
    return new Response(bodyText + "there", {
      status: 200,
      headers: {
        "Content-Type": "text/plain",
      },
    });
  },
};