Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu

1,595次阅读
没有评论

English | 简体中文

Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu

Malagu

Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu
Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu
Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu
Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu
Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu

Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu

Malagu 是基于 TypeScript 的 Serverless First、组件化、平台无关的渐进式应用框架。

特征

  • 约定大于配置,零配置,开箱即用
  • TypeScript 版 Spring Boot
  • Serverless First
  • 平台不锁定
  • 支持前后端一体化,前端框架不锁定
  • 支持微服务
  • 组件化,渐进式
  • 命令行工具插件化
  • 依赖注入
  • 面向切面编程(AOP)
  • 集成了流行的 ORM 框架,使用装饰器声明式事务管理
  • 支持 OIDC 认证
  • 支持 OAuth2 授权
  • 使用 rxjs 管理状态
  • 提供 REST 和 RPC 两种接口风格

Malagu 名字由来:在我的家乡,谐音“吗啦咕”是小石头的意思,小石头堆砌起来可以建成高楼大厦、道路桥梁,而 Malagu 组件编排可以实现千变万化的应用。

快速开始

# 安装命令行工具
npm install -g @malagu/cli

# 初始化
malagu init -o project-name
cd project-name # 进入项目根目录

# 运行
malagu serve

# 部署
malagu deploy -m scf # 部署到腾讯云云函数(SCF)
malagu deploy -m fc # 部署到阿里云函数计算(FC)
malagu deploy -m lambda # 部署到 AWS Lambda

Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu

示例

文档

依赖注入

// 类对象注入
@Component()
export class A {

}

@Component()
export class B {
@Autowired()
protected a: A;
}

// 配置属性注入
@Component()
export class C {
@Value(foo) // 支持 EL 表达式语法,如 @Value(‘obj.xxx’)、@Value(‘arr[1]’) 等等
protected foo: string;
}

数据库操作

import { Controller, Get, Param, Delete, Put, Post, Body } from @malagu/mvc/lib/node;
import { Transactional, OrmContext } from @malagu/typeorm/lib/node;
import { User } from ./entity;
@Controller(users)
export class UserController {

@Get()
@Transactional({ readOnly: true })
list(): Promise<User[]> {
const repo = OrmContext.getRepository(User);
return repo.find();
}
@Get(:id)
@Transactional({ readOnly: true })
get(@Param(id) id: number): Promise<User | undefined> {
const repo = OrmContext.getRepository(User);
return repo.findOne(id);
}
@Delete(:id)
@Transactional()
async remove(@Param(id) id: number): Promise<void> {
const repo = OrmContext.getRepository(User);
await repo.delete(id);
}
@Put()
@Transactional()
async modify(@Body() user: User): Promise<void> {
const repo = OrmContext.getRepository(User);
await repo.update(user.id, user);
}
@Post()
@Transactional()
create(@Body() user: User): Promise<User> {
const repo = OrmContext.getRepository(User);
return repo.save(user);
}
}

交流群

Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu

状态

Gitee 推荐 | TypeScript 编写的渐进式应用框架 Malagu

Read More 

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2023 年 3 月
 12345
6789101112
13141516171819
20212223242526
2728293031  
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026 Jay 2025-12-22 09...
面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25

面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25

面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25 鹭羽 2025-12-13 22:37...
钉钉又发新版本!把 AI 搬进每一次对话和会议

钉钉又发新版本!把 AI 搬进每一次对话和会议

钉钉又发新版本!把 AI 搬进每一次对话和会议 梦晨 2025-12-11 15:33:51 来源:量子位 A...
商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1

商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1

商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1 十三 2025-12-15 14:13:14 ...
MEET2026挤爆了,AI圈今年最该听的20+场演讲&对谈都在这

MEET2026挤爆了,AI圈今年最该听的20+场演讲&对谈都在这

MEET2026挤爆了,AI圈今年最该听的20+场演讲&对谈都在这 西风 2025-12-11 15:...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
预见未来:96位前沿先锋超万字核心观点总结,抢抓未来产业新高地

预见未来:96位前沿先锋超万字核心观点总结,抢抓未来产业新高地

预见未来:96位前沿先锋超万字核心观点总结,抢抓未来产业新高地 henry 2025-12-11 10:27:...
Meta公开抄阿里Qwen作业,还闭源了…

Meta公开抄阿里Qwen作业,还闭源了…

Meta公开抄阿里Qwen作业,还闭源了… Jay 2025-12-11 11:48:25 来源:量子位 Ja...
MEET2026挤爆了,AI圈今年最该听的20+场演讲&对谈都在这

MEET2026挤爆了,AI圈今年最该听的20+场演讲&对谈都在这

MEET2026挤爆了,AI圈今年最该听的20+场演讲&对谈都在这 西风 2025-12-11 15:...
钉钉又发新版本!把 AI 搬进每一次对话和会议

钉钉又发新版本!把 AI 搬进每一次对话和会议

钉钉又发新版本!把 AI 搬进每一次对话和会议 梦晨 2025-12-11 15:33:51 来源:量子位 A...