
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
typescript-boot
Advanced tools
typescript-boot, This is a scaffolding that allows you to quickly start developing api interface services using typescript
typescript-boot
这是一个可以帮助你用typescript快速开发后端API接口服务的脚手架。同时支持通过注解生成完全可供前端同学开发参考的在线接口文档。
里面提供了包括session会话管理、权限管理、日志管理的开箱即用功能,同时又支持完全自定义这些管理器。
还提供了方便操作数据库的方式,支持各种数据库(支持mysql、达梦数据库、其他数据库也很方便可以实现)。对数据库的操作支持对象映射。
以下是一个简单示例:
更多功能可以参考这个完整的、可运行的示例:https://github.com/seeksdream/typescript-boot-demo
1,首先安装依赖
npm install typescript-boot
2,编写代码
// 首先,编写一个接口服务:
@apiDoc('权限认证') // 描述服务名称
@apiPermission(NoRequiredPermission) // 设置访问当前接口服务的前置条件,如无需登录、需要登录、仅限指定角色登录等
@apiPath('/account') //设置访问此服务下的接口的前缀路径
export default class AccountService extends BaseService{
@apiDoc('登录')
@apiReturn('会话token(string)') // 描述返回结果中数据内容
@apiPath('login') //结合服务路径/account,最终此接口的访问路径为:http://localhost:端口/account/login
async login(
@apiParamFromBody('登录账号') account:string, // 从body中获取account属性,并描述account的含义为:登录账号
@apiParamFromBody('登录密码(MD5)') password:string, // 从body中获取password属性,并描述password的含义为:登录密码
@apiRequest() req
) {
// TODO 实现接口内容
const token = '';
return this.success(token);
}
}
// 然后,在你的主程序中通过以下代码发布接口服务并启动
import 'reflect-metadata';
import {SeeksWebServer} from 'typescript-boot';
const port = 3333;
const server = new SeeksWebServer(port);
server.publishService(new AccountService()); // 注册一个api服务
server.start(); // 启动服务,然后就可以调用接口了
此刻,你的接口就可以被调用了。
同时,你还可以同通过以下链接来查看接口文档:
http://localhost:端口/typescript-boot
FAQs
typescript-boot, This is a scaffolding that allows you to quickly start developing api interface services using typescript
The npm package typescript-boot receives a total of 53 weekly downloads. As such, typescript-boot popularity was classified as not popular.
We found that typescript-boot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.