10 Star 171 Fork 16

GVPcellbang/malagu

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

English | 简体中文

Malagu Logo

Malagu

GitHub license npm version npm downloads Build Status star

Cloud Studio Template

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

Features

  • Convention over 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 -o project-name
cd project-name # Enter the project root directory

# Running
malagu serve

# Deployment
malagu deploy -m scf      # Deploy to Tencent Cloud Function(SCF)
malagu deploy -m fc       # Deploy to Alibaba Cloud Function Compute(FC)
malagu deploy -m lambda   # Deploy to AWS Lambda

Quick Start

Samples

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

Status

Alt

MIT License Copyright (c) 2019 Cellbang 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.

About

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

Releases

No release

Contributors

All

Activities

Load More
can not load any more
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/cellbang/malagu.git
git@gitee.com:cellbang/malagu.git
cellbang
malagu
malagu
main

Search