koa icon indicating copy to clipboard operation
koa copied to clipboard

Better TypeScript support

Open flycran opened this issue 2 years ago • 2 comments

Do you want to consider using TypeScript to refactor code to get better TypeScript syntax support? And updated to koa3.

flycran avatar Jan 14 '23 04:01 flycran

import type { FastifyPluginAsyncTypebox } from '@fastify/type-provider-typebox';
import { Type } from '@sinclair/typebox';

export default (async (app) => {
  app.get(
    '/hello-world',
    {
      schema: {
        response: {
          200: Type.Object({
            message: Type.String(),
          }),
        },
      },
    },
    async (request, reply) => {
      return reply.send({
        message: 'Hello, World!',
      });
    },
  );
}) as FastifyPluginAsyncTypebox;

Shyam-Chen avatar Jun 16 '23 09:06 Shyam-Chen