1.1.5 • Published 2 years ago

decadent v1.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Decadent

Simple framework for REST API development

Futures

  • Customizable logger
  • Swagger documentation generation
  • Multipart body
  • Rate limiting
  • Send responses using precompiled schemas

Example

import {FastifyReply, FastifyRequest} from "fastify";
import {
    Factory, 
    Controller, 
    Post
} from "decadent";

@Controller({
    route: "/users"
})
class Users {
    @Post('/hello', {
        secure: true,
        schema: {
            body: {
                name: { type: 'string' }
            }
        }
    })
    say(request: FastifyRequest<{
        Body: {
            name: string;
        }
    }>, reply: FastifyReply) {
        reply.send({ hello: request.body.name });
    }
}

const app = Factory.create({
    controllers: [Users]
});

// Fastify authorization middleware
app.secureHandler = (request, reply, done) => done();

// Swagger secure route annotation
app.secureBuilder = () => ([
    {
        bearerAuth: []
    }
]);

app.listen({ port: 3000 });

License

ISC

1.1.1

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.1.5

2 years ago

1.0.6

2 years ago

1.1.4

2 years ago

1.0.5

2 years ago

1.1.3

2 years ago

1.0.4

2 years ago

1.1.2

2 years ago

1.0.3

2 years ago

1.0.6-fix

2 years ago

1.0.10

2 years ago

1.0.0

2 years ago