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

robot-frame

v1.1.8

Published

A MVC framework based on koa2.0

Downloads

5

Readme

ROBOT

NPM version Build Status

What

一个基于 Koa 2.0 的 MVC 框架

Why

基于 Koa 是因为它提供了一个极小的核心的 Node http 服务,同时基于中间件方式很方便扩展, 但是 Koa 当一个框架用还远远不够,需要自己开发或用第三方的中间件来组装自己的应用, 第三方中间件很多质量参差不齐、更新缓慢,所以催生了 Robot,整合了常用中间件, 以达到迅速使用 Koa 开发自己的应用目的

How

独立安装框架 npm install -S robot-frame

或安装脚手架工具 npm install -g robot-cli

脚手架可以帮你自动生成项目目录结构 ==》robot -c mode -d path

mode 指生成的项目类型,选值 common、vue、react

path 指项目生成到的目录

robot-cli 详细说明

More

demo 目录为演示的常规项目,可执行 npm run demo 配合下面的说明加深使用理解

  • 框架常规目录结构

    • www 传统的 MVC 目录(Controller,Model,View)
    • static 静态资源目录
    • index.js 为入口文件
    • routers.js 配置路由
    • config.js 配置文件
  • 如何使用 Robot 开发

    • 如项目示例 routers.js,配置路由

      router.get( '/', reflectAction( 'home.index' ) )

      自动映射到 www/controller 的实例方法

    • 框架提供简单的辅助方法,如同步设置数据

      this.assign( 'config',{ keys : 'xxx' })

      异步拉取数据

      this.assign( 'uinfo', ( done ) => {
          setTimeout(() => {
              done( {
                  name : 'ygm'
              } )
          }, 100 )
      })

      获取数据渲染

      return this.fetchData().then(( data ) => {
          ctx.render( 'home/index', data )
      })

      fetchData 自动拉取数据,render 自动加载 view 下模板进行渲染

    • 项目默认使用 DEBUG 模式,经常修改的文件会自动应用热更新

  • 关于模块依赖

    • ***** 依赖中间件 *******
    • koa-favicon
    • koa-bodyparser
    • koa-response-time
    • koa-router
    • ***** 依赖模块 *******
    • bluebird
    • nunjucks
    • csrf
    • koa-send

Other

有任何问题可与我联系~