1.1.5 • Published 3 years ago

decadent v1.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
3 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

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.1.5

3 years ago

1.0.6

3 years ago

1.1.4

3 years ago

1.0.5

3 years ago

1.1.3

3 years ago

1.0.4

3 years ago

1.1.2

3 years ago

1.0.3

3 years ago

1.0.6-fix

3 years ago

1.0.10

3 years ago

1.0.0

3 years ago