当前位置: 首页 > 软件库 > 云计算 > Serverless 系统 >

malagu

授权协议 MIT License
开发语言 JavaScript
所属分类 云计算、 Serverless 系统
软件类型 开源软件
地区 不详
投 递 者 颛孙森
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

English | 简体中文

Malagu Logo

Malagu

Build Status

Malagu is a Serverless First, componentized, platform-independent progressive application framework based on TypeScript.

Features

  • Convention is greater than configuration, zero configuration, ready to use out of the box
  • Spring Boot for TypeScript
  • Serverless First
  • The platform is not locked
  • Support front-end and back-end integration, and the front-end frame is not locked
  • Support microservices
  • Componentization, progressive
  • Pluginization of command line tools
  • Dependency injection
  • Aspect Oriented Programming (AOP)
  • Integrate with popular ORM framework and use decorator declarative transaction management
  • Support OIDC certification
  • Support OAuth2 authorization
  • Use rxjs to manage status
  • Provides two interface styles, REST and RPC

The origin of Malagu's name: In my hometown, the homophonic "Ma Lagu" means small stones. The small stones can be piled up to build high-rise buildings, roads and bridges, and the arrangement of Malagu components can realize ever-changing applications.

Quick start

# Install command-line tools
npm install -g @malagu/cli

# Initialization
malagu init project-name
cd project-name # Enter the project root directory

# Running
malagu serve

# Deployment
malagu deploy

Quick start

Example

View Online Sample Template

Documentation

Dependency injection

// Class object injection
@Component()
export class A {

}

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

// Configuration property injection
@Component()
export class C {
    @Value('foo') // Support EL expression syntax, such as @Value('obj.xxx'), @Value('arr[1]') etc.
    protected foo: string;
}

Database operations

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);
    }
}

Discuss group

群二维码.png

  • 导言 本文已参与「开源摘星计划」,欢迎正在阅读的你加入。活动链接:https://github.com/weopenprojects/WeOpen-Star malagu的认证与授权参考spring-security思想,详细介绍请移步官方文档。malagu除了基本的security外提供了ODIC 的认证和 OAuth2.0 的授权能力,本文主要介绍@malagu/security组件的基本应用

  • 导言 本文已参与「开源摘星计划」,欢迎正在阅读的你加入。活动链接:https://github.com/weopenprojects/WeOpen-Star 日志是追踪错误和事件流的首选方式,对于serverless应用,云平台会为我们收集日志,如果使用云平台部署可以跳过本文章。但是,如果你想部署到传统平台或者自定义收集日志请继续… 在java开发我们通常使用Log4j,在前端开发中我们通常使用c