pomjs
Module Solution base on Vue
Last updated 2 years ago by zephyr419 .
AGPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pomjs 
SYNC missed versions from official npm registry.

pomjs

基于Koa2+vue2+webpack的node解决方案,主要feature:

  1. 默认集成 session(支持cookie、redis)
  2. 默认集成 route,以REST API方式提供服务
  3. 提供了data模块,支持数据源自定义接入
  4. 提供GRPC完整解决方案,集成saluki
  5. 完善的日志监控体系
  6. 支持调用链路监控

Route

route模块主要请求转发和执行

pomjs 支持几种资源的加载

  1. static 静态资源

html,css,js,png等图片格式

为了对cdn更友好,pomjs在访问路径上做了约定,加上固定前缀:static

http://localhost/static/**.html

http://localhost/static/**.css
http://localhost/static/**.js
http://localhost/static/**.png
  1. API请求

遵循规则 api/xxx

##http://localhost/api/***

http://localhost/api/hello --》pages/index/index.js hello()
http://localhost/api/user/get --》pages/user/index.js get()

SSR

服务端渲染会先执行API Control,然后执行vue渲染


http://localhost/user/login --》pages/user/index.js.login() + pages/user/login.vue
http://localhost/user|/ --》pages/index/index.js.user() + pages/index/user.vue

RPC

pomjs 集成了saluki https://github.com/quancheng-ec/saluki 这是基于grpc的完整rpc商用解决方案

在config配置里增加service的声明即可使用了

 {saluki: {
        root:path.join(__dirname,'../node_modules/quancheng-service-api/src/main/proto'),// PB的定义文件路径
        group: 'Default',// 环境分组信息
        host: 'daily.quancheng-ec.com',// saluki的注册中心地址
        port: '8500',//saluki的注册中心端口
        services: {
            helloService: 'com.quancheng.examples.service.HelloService:Default:1.0.0' // name:serviceName:serviceGroup:serviceVersion
        }
    }
 }   

使用方式,在function中添加 service的参数声明


const context = {
    title: "qc",
    layout: 'admin.html'
}

export default class Index {

    constructor() {

    }

    async login(ctx,services) {

        const hello = services.helloService;
        try {
            const r = await hello.sayHello({name: 'world'});
            console.log(r);
            return  Object.assign(r, context)
        } catch (e) {
            console.error(e);
        }
        return Object.assign({}, context);
    }
}    


完整的例子需要看example,后续补上

Current Tags

  • 0.1.27                                ...           latest (2 years ago)

136 Versions

  • 0.1.27                                ...           2 years ago
  • 0.1.26                                ...           2 years ago
  • 0.1.25                                ...           2 years ago
  • 0.1.24                                ...           2 years ago
  • 0.1.23-new-consul                                ...           2 years ago
  • 0.1.23-beta-2                                ...           2 years ago
  • 0.1.23-beta-1                                ...           2 years ago
  • 0.1.23-consul-refactor-2                                ...           2 years ago
  • 0.1.23-consul-refactor                                ...           2 years ago
  • 0.1.23                                ...           2 years ago
  • 0.1.22                                ...           2 years ago
  • 0.1.21                                ...           2 years ago
  • 0.1.20                                ...           2 years ago
  • 0.1.19                                ...           2 years ago
  • 0.1.18                                ...           2 years ago
  • 0.1.17                                ...           2 years ago
  • 0.1.16                                ...           2 years ago
  • 0.1.15                                ...           2 years ago
  • 0.1.14-autoexit                                ...           2 years ago
  • 0.1.13-autoexit                                ...           2 years ago
  • 0.1.14                                ...           2 years ago
  • 0.1.13                                ...           2 years ago
  • 0.1.12                                ...           2 years ago
  • 0.1.11                                ...           2 years ago
  • 0.1.10                                ...           2 years ago
  • 0.1.9                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 1.0.0-beta.1                                ...           2 years ago
  • 0.1.8                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.99                                ...           2 years ago
  • 0.0.98                                ...           2 years ago
  • 0.0.97                                ...           2 years ago
  • 0.0.96                                ...           3 years ago
  • 0.0.95                                ...           3 years ago
  • 0.0.94                                ...           3 years ago
  • 0.0.93                                ...           3 years ago
  • 0.0.92                                ...           3 years ago
  • 0.0.91                                ...           3 years ago
  • 0.0.90                                ...           3 years ago
  • 0.0.89                                ...           3 years ago
  • 0.0.87                                ...           3 years ago
  • 0.0.86                                ...           3 years ago
  • 0.0.85                                ...           3 years ago
  • 0.0.84                                ...           3 years ago
  • 0.0.83                                ...           3 years ago
  • 0.0.82                                ...           3 years ago
  • 0.0.81                                ...           3 years ago
  • 0.0.80                                ...           3 years ago
  • 0.0.79                                ...           3 years ago
  • 0.0.78                                ...           3 years ago
  • 0.0.77                                ...           3 years ago
  • 0.0.76                                ...           3 years ago
  • 0.0.75                                ...           3 years ago
  • 0.0.74                                ...           3 years ago
  • 0.0.73                                ...           3 years ago
  • 0.0.72                                ...           3 years ago
  • 0.0.71                                ...           3 years ago
  • 0.0.70                                ...           3 years ago
  • 0.0.69                                ...           3 years ago
  • 0.0.68                                ...           3 years ago
  • 0.0.67                                ...           3 years ago
  • 0.0.66                                ...           3 years ago
  • 0.0.65                                ...           3 years ago
  • 0.0.64                                ...           3 years ago
  • 0.0.63                                ...           3 years ago
  • 0.0.62                                ...           3 years ago
  • 0.0.61                                ...           3 years ago
  • 0.0.60                                ...           3 years ago
  • 0.0.59                                ...           3 years ago
  • 0.0.58                                ...           3 years ago
  • 0.0.57                                ...           3 years ago
  • 0.0.56                                ...           3 years ago
  • 0.0.55                                ...           3 years ago
  • 0.0.54                                ...           3 years ago
  • 0.0.53                                ...           3 years ago
  • 0.0.52                                ...           3 years ago
  • 0.0.51                                ...           3 years ago
  • 0.0.50                                ...           3 years ago
  • 0.0.49                                ...           3 years ago
  • 0.0.48                                ...           3 years ago
  • 0.0.47                                ...           3 years ago
  • 0.0.46                                ...           3 years ago
  • 0.0.45                                ...           3 years ago
  • 0.0.44                                ...           3 years ago
  • 0.0.43                                ...           3 years ago
  • 0.0.42                                ...           3 years ago
  • 0.0.41                                ...           3 years ago
  • 0.0.40                                ...           3 years ago
  • 0.0.39                                ...           3 years ago
  • 0.0.38                                ...           3 years ago
  • 0.0.37                                ...           3 years ago
  • 0.0.36                                ...           3 years ago
  • 0.0.35                                ...           3 years ago
  • 0.0.34                                ...           3 years ago
  • 0.0.33                                ...           3 years ago
  • 0.0.32                                ...           3 years ago
  • 0.0.31                                ...           3 years ago
  • 0.0.30                                ...           3 years ago
  • 0.0.29                                ...           3 years ago
  • 0.0.28                                ...           3 years ago
  • 0.0.27                                ...           3 years ago
  • 0.0.26                                ...           3 years ago
  • 0.0.25                                ...           3 years ago
  • 0.0.24                                ...           3 years ago
  • 0.0.23                                ...           3 years ago
  • 0.0.22                                ...           3 years ago
  • 0.0.21                                ...           3 years ago
  • 0.0.20                                ...           3 years ago
  • 0.0.19                                ...           3 years ago
  • 0.0.18                                ...           3 years ago
  • 0.0.17                                ...           3 years ago
  • 0.0.16                                ...           3 years ago
  • 0.0.15                                ...           3 years ago
  • 0.0.14                                ...           3 years ago
  • 0.0.13                                ...           3 years ago
  • 0.0.12                                ...           3 years ago
  • 0.0.11                                ...           3 years ago
  • 0.0.10                                ...           3 years ago
  • 0.0.9                                ...           3 years ago
  • 0.0.8                                ...           3 years ago
  • 0.0.7                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2017 © taobao.org |