pomjs
Module Solution base on Vue
3,774
7
| Install | |
|---|---|
npm install pomjs@1.0.2 |
|
| Latest Version: | 1.0.2 |
| Vue: | 2 |
| License: | AGPL-3.0 |
| Last Updated: | Sep 19, 2018 |
| Links: | GitHub · npm |
Maintainer: yingjunjiao
pomjs
基于Koa2+vue2+webpack的node解决方案,主要feature:
- 默认集成 session(支持cookie、redis)
- 默认集成 route,以REST API方式提供服务
- 提供了data模块,支持数据源自定义接入
- 提供GRPC完整解决方案,集成saluki
- 完善的日志监控体系
- 支持调用链路监控
Route
route模块主要请求转发和执行
pomjs 支持几种资源的加载
- static 静态资源
html,css,js,png等图片格式
为了对cdn更友好,pomjs在访问路径上做了约定,加上固定前缀:static
http://localhost/static/**.html
http://localhost/static/**.css
http://localhost/static/**.js
http://localhost/static/**.png
- 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,后续补上
Related Packages
nuxt-define
One utility function for module authors to define compiler constants for all bui...
13,412,511
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.2 | ^2.5.2 | AGPL-3.0 | |
| 1.0.1 | ^2.5.2 | AGPL-3.0 | |
| 1.0.0 | ^2.5.2 | AGPL-3.0 | |
| 0.1.27 | 2.2.6 | AGPL-3.0 | |
| 0.1.26 | 2.2.6 | AGPL-3.0 | |
| 0.1.25 | 2.2.6 | AGPL-3.0 | |
| 0.1.24 | 2.2.6 | AGPL-3.0 | |
| 0.1.23 | 2.2.6 | AGPL-3.0 | |
| 0.1.22 | 2.2.6 | AGPL-3.0 | |
| 0.1.21 | 2.2.6 | AGPL-3.0 | |
| 0.1.20 | 2.2.6 | AGPL-3.0 | |
| 0.1.19 | 2.2.6 | AGPL-3.0 | |
| 0.1.18 | 2.2.6 | AGPL-3.0 | |
| 0.1.17 | 2.2.6 | AGPL-3.0 | |
| 0.1.16 | 2.2.6 | AGPL-3.0 | |
| 0.1.15 | 2.2.6 | AGPL-3.0 | |
| 0.1.14 | 2.2.6 | AGPL-3.0 | |
| 0.1.13 | 2.2.6 | AGPL-3.0 | |
| 0.1.12 | 2.2.6 | AGPL-3.0 | |
| 0.1.11 | 2.2.6 | AGPL-3.0 | |
| 0.1.10 | 2.2.6 | AGPL-3.0 | |
| 0.1.9 | 2.2.6 | AGPL-3.0 | |
| 0.1.8 | 2.2.6 | AGPL-3.0 | |
| 0.1.7 | 2.2.6 | AGPL-3.0 | |
| 0.1.6 | 2.2.6 | AGPL-3.0 | |
| 0.1.5 | 2.2.6 | AGPL-3.0 | |
| 0.1.4 | 2.2.6 | AGPL-3.0 | |
| 0.1.3 | 2.2.6 | AGPL-3.0 | |
| 0.1.2 | 2.2.6 | AGPL-3.0 | |
| 0.1.1 | 2.2.6 | AGPL-3.0 |
Showing the latest 30 of 128. See every release on npm
Pre-releases (8)
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.0-beta.1 | ^2.5.2 | AGPL-3.0 | |
| 0.1.23-beta-2 | 2.2.6 | AGPL-3.0 | |
| 0.1.23-beta-1 | 2.2.6 | AGPL-3.0 | |
| 0.1.23-new-consul | 2.2.6 | AGPL-3.0 | |
| 0.1.23-consul-refactor-2 | 2.2.6 | AGPL-3.0 | |
| 0.1.23-consul-refactor | 2.2.6 | AGPL-3.0 | |
| 0.1.14-autoexit | 2.2.6 | AGPL-3.0 | |
| 0.1.13-autoexit | 2.2.6 | AGPL-3.0 |