1.0.1 • Published 7 months ago

@horlys/elysia-response v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Elysia Response

This library is a plugin for Elysia that allows you to standardize your answers, so you have a single format.

It's part of the “Horlys” suite, a project designed to bring together libraries useful in the development of javascript projects.

Installation

bun install @horlys/elysia-response

Usage

import { Elysia } from "elysia";
import { response } from "@horlys/elysia-response";

const app = new Elysia()
  .use(response)
  .get("/", ({ respond }) => {
    return respond(200, "Hello World", { hello: "world" });
  })

Documentation

Response

Here is the object returned in the response:

{
  status: number;
  message: string;
  data: any;
}

Function

Here is the arguments of the respond function:

  • status: number
  • message: string
  • data: object
1.0.1

7 months ago

1.0.0

7 months ago