Home

Awesome

<p align="center"> <img src="https://raw.githubusercontent.com/FastifyResty/fastify-resty/gh-images/logo/full-logo.png" width="650" height="auto"/> </p> <div align="center">

Build Workflow codecov Known Vulnerabilities Depfu

</div> <div align="center">

GitHub license Maintenance lerna

</div>

Modern and declarative REST API framework for superfast and oversimplification backend development, build on top of Fastify and TypeScript.

<hr> <p align="center"> If you find this useful, please don't forget to star :star:&nbsp; the repo, as this will help to promote the project. </p> <hr>

Benefits :dart:

Install :pushpin:

Core module

$ npm install @fastify-resty/core fastify

TypeORM connector

$ npm install @fastify-resty/typeorm typeorm

Usage :rocket:

TypeORM Entity (author.entity.ts):
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;
}
Entity controller (author.controller.ts):
import { EntityController } from '@fastify-resty/core';
import AuthorEntity from './author.entity';

@EntityController(AuthorEntity, '/authors')
export default class AuthorController {}
Bootstrap (app.ts):
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();
Generated routes:
└── /
    └── users (DELETE|GET|PATCH|POST|PUT)
        └── / (DELETE|GET|PATCH|POST|PUT)
            └── :id (DELETE)
                :id (GET)
                :id (PATCH)
                :id (PUT)

Documentation :books:

Packages :package:

Examples :microscope:

Issues and contributions :memo:

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.

License

MIT License

Icons made by <a href="https://www.flaticon.com/authors/eucalyp" title="Eucalyp">Eucalyp</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>