Need help with malagu?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

cellbang
157 Stars 19 Forks MIT License 331 Commits 1 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

# 243,146
TypeScr...
HTML
serverl...
platfor...
282 commits
# 30,326
TypeScr...
CSS
iscroll
Shell
20 commits
# 144,651
CSS
ttf
Less
api-tes...
5 commits
# 60,595
PHP
Shell
alibaba...
Docker
1 commit

English | 简体中文

Malagu

GitHub license npm version npm downloads TravisCI

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

Features

  • Convention over configuration, zero configuration, out of the box
  • Spring Boot for TypeScript
  • Serverless First
  • The platform is not locked.
  • Support for front-end integration, front-end framework is not locked
  • Support microservices
  • Componentized, Progressive
  • Plug-in command line tools
  • Dependency injection
  • Facet-oriented programming (AOP)
  • Integrates with the popular ORM framework for declarative transaction management using decorators.
  • Support for OIDC accreditation
  • OAuth2 authorization support
  • Managing Status with rxjs
  • Both REST and RPC interface styles available

The Malagu name comes from the fact that where I come from, the word "malagu" means small stone, and while small stones can be built into tall buildings, roads, and bridges, the Malagu Component layout can be used in a myriad of ways.

Quick start

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

Initialization

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

Running

malagu serve

Deployment

malagu deploy

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.