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

doodoo.js

v2.0.5

Published

Doodoo web app framework

Downloads

13

Readme

Doodoo.js

license travis-ci codecov Dependency Status

Doodoo.js -- 中文最佳实践Node.js Web快速开发框架,支持Koa.js, Express.js中间件。

//base controller, app/demo/controller/base.js
module.exports = class extends doodoo.Controller {

    async _initialize() {
        console.log('base _initialize');
    }

    async isLogin() {
        console.log('base isLogin');
    }
}

//index controller, app/demo/controller/index.js
const base = require('./base');
module.exports = class extends base {

    async _initialize() {
        await super._initialize();
    }

    async index() {
        this.success("Hello Doodoo.js");
    }

    async index2() {
        this.fail("Hello Doodoo.js");
    }
}

环境要求:Node.js >= 8.0.0

特性

  • 支持koa全部中间件
  • 支持使用 ES6+ 全部特性来开发项目
  • 支持断点调试 ES6+ 项目
  • 支持多种项目结构和多种项目环境
  • 支持 Route, Controller 中使用Koa.js的所有API
  • 支持多级 Controller
  • 支持模块化开发
  • 支持钩子机制
  • 支持插件机制
  • 支持错误处理
  • 支持全局 doodoo 变量
  • 支持 mysql, mongodb 数据库
  • 支持前置,后置操作
  • 支持 Restful 设计
  • 支持启动自定义
  • 支持环境加载配置
  • ...

安装

yarn add doodoo.js

创建启动文件

// app/index.js启动文件
const Doodoo = require('doodoo.js');

// 初始化项目
const app = new Doodoo();

// 启动项目
app.start();

方法

ctx上的函数或参数将自动加载到controller,例如支持 this.body = 'Hello World!', ctx中具体的API请参考Koa.js, controller中的扩展方法如下。

this.ctx;
this.next;
this.isGet();
this.isPost();
this.isAjax();
this.isPjax();
this.isMethod(method);
this.hook.run(name, ...args);
this.download(file);
this.view(data);
this.success(errmsg: "ok", errcode: 0, data: data);
this.error(errmsg = "error", errcode = 1);

配置

# 应用配置
app:
  root: app
  port: 3000
  host: "127.0.0.1"
  prefix: ""

# 静态资源服务
static:
  dir: www
  maxAge: 30 * 24 * 60 * 60
  dynamic: true

其他

// 控制器初始化,前置,后置,空操作
async _initialize()
async _before()
async _before_index()
async index()
async _after_index()
async _after()

开始应用

// 下载demo
git clone https://github.com/doodooke/doodoo.js.git
// 安装依赖
yarn install
// 进入项目
cd doodoo.js/example
// 启动项目
node app.js

启动信息

[doodoo] Version: 2.0.0
[doodoo] Website: 127.0.0.1
[doodoo] Nodejs Version: v8.12.0
[doodoo] Nodejs Platform: darwin x64
[doodoo] Server Enviroment: development
[doodoo] Server Startup Time: 212ms
[doodoo] Server Current Time: 2018-08-21 11:17:19
[doodoo] Server Running At: http://127.0.0.1:3000

使用手册

Doodoo.js使用手册

问题反馈

在使用中有任何问题,请使用以下联系方式联系我们

QQ群: 874449168(交流群①)

EMAIL: [email protected]

Github: https://github.com/doodooke/doodoo.js

官网

多多客Doodooke小程序