Gathering detailed insights and metrics for @tsed/common
Gathering detailed insights and metrics for @tsed/common
Gathering detailed insights and metrics for @tsed/common
Gathering detailed insights and metrics for @tsed/common
📐 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. ⭐️ Star to support our work!
npm install @tsed/common
Typescript
Module System
Node Version
NPM Version
75.5
Supply Chain
95.8
Quality
95.2
Maintenance
100
Vulnerability
99.3
License
TypeScript (97.53%)
JavaScript (1.58%)
EJS (0.7%)
HTML (0.1%)
CSS (0.09%)
Shell (0.01%)
Total Downloads
3,221,760
Last Day
2,086
Last Week
10,933
Last Month
47,377
Last Year
790,612
2,891 Stars
5,662 Commits
290 Forks
43 Watching
42 Branches
142 Contributors
Latest Version
8.4.6
Package Id
@tsed/common@8.4.6
Unpacked Size
11.89 kB
Size
4.42 kB
File Count
7
NPM Version
10.8.2
Node Version
20.18.2
Publised On
31 Jan 2025
Cumulative downloads
Total Downloads
Last day
-26.1%
2,086
Compared to previous day
Last week
-10.1%
10,933
Compared to previous week
Last month
-7.9%
47,377
Compared to previous month
Last year
14.7%
790,612
Compared to previous year
3
2
6
A Node.js and TypeScript Framework on top of Express. It provides a lot of decorators and guidelines to write your code.
Ts.ED is a framework on top of Express that helps you to write your application in TypeScript (or in ES6). It provides a lot of decorators to make your code more readable and less error-prone.
Documentation is available on https://tsed.dev
See our getting started here to create new Ts.ED project or use our CLI
Examples are available on https://tsed.devtutorials/
Here an example to create a Server with Ts.ED:
1import {Configuration, Inject} from "@tsed/di"; 2import {PlatformApplication} from "@tsed/platform-http"; 3import "@tsed/platform-express"; 4import Path from "node:path"; 5import cookieParser from "cookie-parser"; 6import compress from "compression"; 7import methodOverride from "method-override"; 8 9@Configuration({ 10 port: 3000, 11 middlewares: ["cookie-parser", "compression", "method-override", "json-parser", "urlencoded-parser"] 12}) 13export class Server {}
To run your server, you have to use Platform API to bootstrap your application with the expected platform like Express.
1import {$log} from "@tsed/logger"; 2import {PlatformExpress} from "@tsed/platform-express"; 3import {Server} from "./Server.js"; 4 5async function bootstrap() { 6 try { 7 $log.debug("Start server..."); 8 const platform = await PlatformExpress.bootstrap(Server); 9 10 await platform.listen(); 11 $log.debug("Server initialized"); 12 } catch (er) { 13 $log.error(er); 14 } 15} 16 17bootstrap();
To customize the server settings see Configure server with decorator
This is a simple controller to expose user resource. It use decorators to build the endpoints:
1import {Inject} from "@tsed/di"; 2import {Summary} from "@tsed/swagger"; 3import { 4 Returns, 5 ReturnsArray, 6 Controller, 7 Get, 8 QueryParams, 9 PathParams, 10 Delete, 11 Post, 12 Required, 13 BodyParams, 14 Status, 15 Put 16} from "@tsed/schema"; 17import {BadRequest} from "@tsed/exceptions"; 18import {UsersService} from "../services/UsersService.js"; 19import {User} from "../models/User.js"; 20 21@Controller("/users") 22export class UsersCtrl { 23 @Inject() 24 protected usersService: UsersService; 25 26 @Get("/:id") 27 @Summary("Get a user from his Id") 28 @Returns(User) 29 async getUser(@PathParams("id") id: string): Promise<User> { 30 return this.usersService.findById(id); 31 } 32 33 @Post("/") 34 @Status(201) 35 @Summary("Create a new user") 36 @Returns(User) 37 async postUser(@Required() @BodyParams() user: User): Promise<User> { 38 return this.usersService.save(user); 39 } 40 41 @Put("/:id") 42 @Status(201) 43 @Summary("Update the given user") 44 @Returns(User) 45 async putUser(@PathParams("id") id: string, @Required() @BodyParams() user: User): Promise<User> { 46 if (user.id !== id) { 47 throw new BadRequest("ID mismatch with the given payload"); 48 } 49 50 return this.usersService.save(user); 51 } 52 53 @Delete("/:id") 54 @Summary("Remove a user") 55 @Status(204) 56 async deleteUser(@PathParams("id") @Required() id: string): Promise<User> { 57 await this.usersService.delete(user); 58 } 59 60 @Get("/") 61 @Summary("Get all users") 62 @ReturnsArray(User) 63 async findUser(@QueryParams("name") name: string) { 64 return this.usersService.find({name}); 65 } 66}
Please read contributing guidelines here.
Thank you to all our backers! 🙏 [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
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.
No vulnerabilities found.
Reason
30 commit(s) and 21 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 3/21 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
86 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More