elysia icon indicating copy to clipboard operation
elysia copied to clipboard

Support class serialization in response

Open victor-teles opened this issue 5 months ago • 0 comments

What version of Elysia is running?

1.1.12

What platform is your computer?

Darwin 24.1.0 arm64 arm

What steps can reproduce the bug?

Instantiate a class and returns it with Elysia:

import { Elysia } from "elysia";

class MyClass {
  constructor(public name: string) {}
}

const object = new MyClass("Elysia");

const app = new Elysia().get("/", () => object).listen(3000);

console.log(
  `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);

The response from GET / is: [object Object]

CleanShot 2024-09-13 at 10 05 36@2x

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

yes

victor-teles avatar Sep 13 '24 13:09 victor-teles