npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pomjs

v0.1.27

Published

Module Solution base on Vue

Downloads

15

Readme

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,后续补上