All Projects → TypedProject → Tsed

TypedProject / Tsed

Licence: mit
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Tsed

tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 2,350 (+21.07%)
Mutual labels:  ioc, koa, dependency-injection, socket-io, decorators, contribution, multer, nodejs-framework, lifecycle-hooks, nodejs-api, typescript-framework
Swagger Express Middleware
Swagger 2.0 middlware and mocks for Express.js
Stars: ✭ 543 (-72.02%)
Mutual labels:  rest-api, middleware, swagger
Swagger Ui
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Stars: ✭ 21,279 (+996.29%)
Mutual labels:  rest-api, swagger-ui, swagger
Awilix Koa
Awilix helpers/middleware for Koa 2
Stars: ✭ 121 (-93.77%)
Mutual labels:  middleware, koa, dependency-injection
Loopback Next
LoopBack makes it easy to build modern API applications that require complex integrations.
Stars: ✭ 3,972 (+104.64%)
Mutual labels:  dependency-injection, ioc, swagger
Typescript Ioc
A Lightweight annotation-based dependency injection container for typescript.
Stars: ✭ 427 (-78%)
Mutual labels:  decorators, dependency-injection, ioc
Django Ninja
💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
Stars: ✭ 875 (-54.92%)
Mutual labels:  rest-api, swagger-ui, swagger
Springdoc Openapi
Library for OpenAPI 3 with spring-boot
Stars: ✭ 1,113 (-42.66%)
Mutual labels:  rest-api, swagger-ui, swagger
Swagger Editor
Swagger Editor
Stars: ✭ 7,365 (+279.44%)
Mutual labels:  rest-api, swagger-ui, swagger
Koa Typeorm Starter
Starter project for using koa with TS and TypeORM
Stars: ✭ 23 (-98.82%)
Mutual labels:  rest-api, koa, dependency-injection
Blog.core
💖 ASP.NET Core 6.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
Stars: ✭ 3,542 (+82.48%)
Mutual labels:  dependency-injection, ioc, swagger
Bottlejs
A powerful dependency injection micro container for JavaScript applications
Stars: ✭ 1,171 (-39.67%)
Mutual labels:  middleware, decorators, dependency-injection
polix
🚀 Node.js Web Framework
Stars: ✭ 32 (-98.35%)
Mutual labels:  ioc, middleware, koa
Pretty Swag
Pretty UI for Swagger spec
Stars: ✭ 112 (-94.23%)
Mutual labels:  rest-api, swagger-ui, swagger
vue3-oop
使用类和依赖注入写vue组件
Stars: ✭ 90 (-95.36%)
Mutual labels:  ioc, dependency-injection, decorators
Node Typescript Koa Rest
REST API boilerplate using NodeJS and KOA2, typescript. Logging and JWT as middlewares. TypeORM with class-validator, SQL CRUD. Docker included. Swagger docs, actions CI and valuable README
Stars: ✭ 739 (-61.93%)
Mutual labels:  rest-api, koa, swagger
Drf Yasg
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.
Stars: ✭ 2,523 (+29.98%)
Mutual labels:  rest-api, swagger-ui, swagger
Flasgger
Easy OpenAPI specs and Swagger UI for your Flask API
Stars: ✭ 2,825 (+45.54%)
Mutual labels:  rest-api, swagger-ui, swagger
Go Book Store Api
Go Sample project to understand Mysql CRUD operation with best practises Includes logging, JWT, Swagger and Transactions
Stars: ✭ 18 (-99.07%)
Mutual labels:  rest-api, swagger-ui, swagger
Koatty
Koa2 + Typescript = Koatty. Use Typescript's decorator implement IOC and AOP.
Stars: ✭ 67 (-96.55%)
Mutual labels:  middleware, koa, ioc

Ts.ED logo


Build & Release PR Welcome Coverage Status npm version semantic-release code style: prettier backers

Website   •   Getting started   •   Slack   •   Twitter

A Node.js and TypeScript Framework on top of Express. It provides a lot of decorators and guidelines to write your code.

What it is

Ts.ED is a Node.js and TypeScript Framework on top of Express/Koa.js. Ts.ED is a framework on top of Express/Koa to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.

Features

  • Use our CLI to create a new project https://cli.tsed.io
  • Support TypeORM, Mongoose, GraphQL, Socket.io, Swagger-ui, Passport.js, etc...
  • Define class as Controller,
  • Define class as Service (IoC),
  • Define class as Middleware and MiddlewareError,
  • Define class as Converter (POJ to Model and Model to POJ),
  • Define root path for an entire controller and versioning your Rest API,
  • Define as sub-route path for a method,
  • Define routes on GET, POST, PUT, DELETE and HEAD verbs,
  • Define middlewares on routes,
  • Define required parameters,
  • Inject data from query string, path parameters, entire body, cookies, session or header,
  • Inject Request, Response, Next object from Express request,
  • Template (View),
  • Testing.

Documentation

Documentation is available on https://tsed.io

Getting started

See our getting started here to create new Ts.ED project or use our CLI

Examples

Examples are available on https://tsed.io/tutorials/

Overview

Server example

Here an example to create a Server with Ts.ED:

import {Configuration, Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";
import "@tsed/platform-express";
import * as Path from "path";                              

export const rootDir = Path.resolve(__dirname);

@Configuration({
  rootDir,
  port: 3000
})
export class Server {
  @Inject()
  app: PlatformApplication;

  public $beforeRoutesInit() {
    const cookieParser = require('cookie-parser'),
      bodyParser = require('body-parser'),
      compress = require('compression'),
      methodOverride = require('method-override');
 
    this.app
      .use(cookieParser())
      .use(compress({}))
      .use(methodOverride())
      .use(bodyParser.json())
      .use(bodyParser.urlencoded({
        extended: true
      }));
  }   
}

To run your server, you have to use Platform API to bootstrap your application with the expected platform like Express.

import {$log} from "@tsed/common";
import {PlatformExpress} from "@tsed/platform-express";
import {Server} from "./Server";

async function bootstrap() {
  try {
    $log.debug("Start server...");
    const platform = await PlatformExpress.bootstrap(Server);

    await platform.listen();
    $log.debug("Server initialized");
  } catch (er) {
    $log.error(er);
  }
}

bootstrap();

To customize the server settings see Configure server with decorator

Controller example

This is a simple controller to expose user resource. It use decorators to build the endpoints:

import {Inject} from "@tsed/di";
import {Summary} from "@tsed/swagger";
import {Controller, Get, QueryParams, PathParams, Delete, Post, Required, BodyParams, Status, Put, Returns, ReturnsArray} from "@tsed/common";
import {BadRequest} from "@tsed/exceptions";
import {UsersService} from "../services/UsersService";
import {User} from "../models/User"; 

@Controller("/users")
export class UsersCtrl {
  @Inject()
  usersService: UsersService;

  @Get("/:id")
  @Summary("Get a user from his Id")
  @Returns(User)
  async getUser(@PathParams("id") id: string): Promise<User> {
     return this.usersService.findById(id);
  }

  @Post("/")
  @Status(201)
  @Summary("Create a new user")
  @Returns(User)
  async postUser(@Required() @BodyParams() user: User): Promise<User> {
    return this.usersService.save(user);
  }

  @Put("/:id")
  @Status(201)
  @Summary("Update the given user")
  @Returns(User)
  async putUser(@PathParams("id") id: string, @Required() @BodyParams() user: User): Promise<User> {
    if (user.id !== id) {
      throw new BadRequest("ID mismatch with the given payload")
    }

    return this.usersService.save(user);
  }
  
  @Delete("/:id")
  @Summary("Remove a user")
  @Status(204)
  async deleteUser(@PathParams("id") @Required() id: string ): Promise<User> {
     await this.usersService.delete(user);
  }
  
  @Get("/")
  @Summary("Get all users")
  @ReturnsArray(User)
  async findUser(@QueryParams("name") name: string){
    return this.usersService.find({name});
  }
}

Contributors

Please read contributing guidelines here.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

License

The MIT License (MIT)

Copyright (c) 2016 - 2020 Romain Lenzotti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].