⚔️ Declarative NodeJS web framework with REST API route auto-generation, DI, and decorators, build on top of Fastify and TypeScript.
MIT License
Modern and declarative REST API framework for superfast and oversimplification backend development, build on top of Fastify and TypeScript.
$ npm install @fastify-resty/core fastify
$ npm install @fastify-resty/typeorm typeorm
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';
@Entity()
export default class Author {
@PrimaryGeneratedColumn()
id: number;
@Column()
firstname: string;
@Column()
lastname: string;
@CreateDateColumn()
created_at: Date;
}
import { EntityController } from '@fastify-resty/core';
import AuthorEntity from './author.entity';
@EntityController(AuthorEntity, '/authors')
export default class AuthorController {}
import fastify from 'fastify';
import { createConnection } from 'typeorm';
import { bootstrap } from '@fastify-resty/core';
import typeorm from '@fastify-resty/typeorm';
import AuthorController from './author.controller';
async function main() {
const app = fastify();
const connection = await createConnection();
app.register(typeorm, { connection });
app.register(bootstrap, { controllers: [AuthorController] });
app.listen(8080, (err, address) => {
console.log(app.printRoutes());
});
}
main();
└── /
└── users (DELETE|GET|PATCH|POST|PUT)
└── / (DELETE|GET|PATCH|POST|PUT)
└── :id (DELETE)
:id (GET)
:id (PATCH)
:id (PUT)
Contributors are welcome, please fork and send pull requests! If you find a bug or have any ideas on how to improve this project please submit an issue.
Icons made by Eucalyp from www.flaticon.com