All Projects → minhdtb → minmin

minhdtb / minmin

Licence: MIT License
MinMin - a tiny typescript web framework based on Express

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to minmin

talos
No description or website provided.
Stars: ✭ 37 (+146.67%)
Mutual labels:  spring-mvc
helloworld-web
Hello World web application in 39 different ways in Java
Stars: ✭ 18 (+20%)
Mutual labels:  spring-mvc
Minimalist-Blog
Tailwind CSS Starter Template - Minimalist Blog
Stars: ✭ 21 (+40%)
Mutual labels:  minimalist
r2
A minimalist HTTP request routing helper for Go.
Stars: ✭ 32 (+113.33%)
Mutual labels:  minimalist
e-commerce-microservices
REST Microservices architecture for E-commerce with Spring boot, Cloud and multiple modules
Stars: ✭ 102 (+580%)
Mutual labels:  spring-mvc
webgui
Web Technologies based Crossplatform GUI Framework with Dark theme
Stars: ✭ 81 (+440%)
Mutual labels:  minimalist
Spring5Certification
Spring Certification: This repository contains my examples and some best references to prepare the Spring 5 certification
Stars: ✭ 30 (+100%)
Mutual labels:  spring-mvc
gobang04
五子棋社区,前后端完全分离,SSM框架,CORS跨域访问,SSO单点登录,Bootstrap界面,RESTful构架风格,Netty即时通信,Token口令授权,Web端与客户端通信。异步请求,面向接口编程。
Stars: ✭ 14 (-6.67%)
Mutual labels:  spring-mvc
klein
the minimalist URL shortener
Stars: ✭ 40 (+166.67%)
Mutual labels:  minimalist
mpi
minimal (n)vim plugins - icons (Under 200 LOC)
Stars: ✭ 32 (+113.33%)
Mutual labels:  minimalist
untheme
A blank WordPress theme for developers.
Stars: ✭ 82 (+446.67%)
Mutual labels:  minimalist
SlimApp
A minimalist andf platform-agnostic application layer for writing graphical applications, with a strong emphasis on simplicity and ease of use.
Stars: ✭ 33 (+120%)
Mutual labels:  minimalist
comet
A minimal and robust BEM-style CSS toolkit.
Stars: ✭ 18 (+20%)
Mutual labels:  minimalist
SpringBootDataSourceMutil
spring-boot、Spring MVC、Mybatis、JTA实现多数据源动态切换,读写分离,加入Retry重试机制
Stars: ✭ 19 (+26.67%)
Mutual labels:  spring-mvc
jcart
JCart is a simple e-commerce application built with Spring.
Stars: ✭ 59 (+293.33%)
Mutual labels:  spring-mvc
pighelper
🐷基于Hybrid+SSM的养猪信息化管理平台,该平台实现了对实时新闻,猪价的爬虫获取,以及各类养殖账单的增删改查等等。该项目适配了移动端界面,最终通过Hybrid混合式App开发技术打包成App,安装在移动端使用
Stars: ✭ 25 (+66.67%)
Mutual labels:  spring-mvc
Java-CMS-Framework-Base jeesite.com
Java管理后台快速开发SSM框架_优化版-JDK1.8 spring,springMVC,MyBatis,mysql,shiro,redis,ehcache
Stars: ✭ 21 (+40%)
Mutual labels:  spring-mvc
nanonote
A minimalist note taking application
Stars: ✭ 35 (+133.33%)
Mutual labels:  minimalist
Obsidian-Harmonic
Harmonic is a minimal and highly customizable theme for Obsidian.md
Stars: ✭ 33 (+120%)
Mutual labels:  minimalist
keeporsweep.net
💻🔀🗑️ Randomly declutter your digital life!
Stars: ✭ 54 (+260%)
Mutual labels:  minimalist

Apache V2 License

1. Introduction

MinMin is a tiny web framework entirely written in typescript, based on ExpressJS and inspired by Java Web

2. How to use

Getting started

Install minmin

npm install --save minmin

Change tsconfig.json looks like

{
  "compilerOptions": {     
      "lib": [
      "dom",
      "es2015"
      ],
      "target": "es5",
      "moduleResolution": "node",
      "experimentalDecorators": true,
      "emitDecoratorMetadata": true,      
  }
}

Define controller

Firstly we create ApiController.ts file then define controller with base url is /api

@Controller('api')
class ApiController {
}

Define request handler

The next step, we need define request handler like this

@Controller('api')
class ApiController {

  @Post('login')
  private async login(@Data('username') username: string,
                      @Data('password') password: string) {
    let user = await User.findOne({username: username});
    if (user) {
      let compare = await user.comparePassword(password);
      if (compare) {              
        return new Result('user', user);
      } else {
        return new Error(401, "Invalid username or password.");
      }
    } else {
        return new Error(404, "Username not found.");
    }
  }
}

The upper code is equivalent to http method handler in expressjs like bellow

app.post('/api/login', function(req, res) {
   var username = req.body.username
   var password = req.body.password  
   ...
})

Start server

The last step is starting web server

import {WebServer} from "minmin"
import './controllers/ApiController' // import the controller here (very important)

const server = new WebServer();
server.setPort(3000);
server.start();

Support Dependency Injection

Support dependency injection since version 0.0.32

import {Controller, Service, Inject} from "minmin"

@Service()
class MyService {

  action(): void {
  }
  
}

@Controller('api')
class ApiController {

  @Inject()
  myService: MyService;
  
  
}

3. Decorators list

Methods

@Get @Post @Put @Delete

Parameters

@Param @Query @Data @Session (deprecated) @Request

Dependency Injection

@Inject @Service

4. Classes list

WebServer Result Error View Redirect

5. Template and demo

simple: https://github.com/minhdtb/minmin-template

with NuxtJS: https://github.com/minhdtb/minmin-nuxt-template

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].