Attempting to create a simple API endpoint in Svelte using RequestHandler from the index.json.ts file
import type { RequestHandler } from '@sveltejs/kit'
export const get: RequestHandler = () => {
return{
body:'Hello from api.',
status:200
}
}
Encountering issues with errors:
Type
is not compatible with type() => { body: string; status: number; }
.RequestHandler<Partial<Record<string, string>>, string | null>
Typecannot be assigned to type{ body: string; status: number; }
MaybePromise<Response>
.
Typedoes not include the necessary properties of type{ body: string; status: number; }
Response
: headers, ok, redirected, statusText, and more. ts(2322)
Have attempted to make an accessible endpoint for the project but these errors persist