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

moa2

v2.0.8

Published

Koa web app framework

Downloads

22

Readme

Moa 2 = Moajs with koa 2.x

Moa2 is a open-source web framework based koa 2.x、mongoose、bluebird、ava that’s optimized for programmer happiness and sustainable productivity. It lets you write beautiful code by favoring convention over configuration.

gitter NPM version

js-standard-style

"Lost, like the Moa is lost" - Maori proverb

技术栈

core

with database

Features

Core

  • [x] 自动加载路由
  • [x] 使用jsonwebtoken做用户鉴权
  • [x] 支持migrate测试
  • [x] 支持ava测试
  • [x] 默认集成res.api,便于写接口
  • [x] 集成supervisor,代码变动,自动重载
  • [x] gulp自动监控文件变动,跑测试
  • [x] gulp routes生成路由说明
  • [x] 使用log4js记录日志

Env

  • production 产品模式,即部署到服务器上的
  • test 测试模式,辅助测试
  • development 开发模式,日志上会有差异

举例

$ export NODE_ENV=production && ./node_modules/.bin/supervisor ./bin/www

or

$ npm run production 

Getting Start

$ git clone --depth=1 https://github.com/moajs/moa2.git <your-project-name>
$ cd <your-project-name>
$ npm install
$ npm start

Koa 2支持3种中间件,其中async/await需要babel支持,根据koa、koa2、koa2-async和express的压测性能比较,性能不是特别好,所以默认Moa2不使用async/await

说明

  • user 是common function
  • student 是GeneratorFunction

浏览器里访问地址

  • http://127.0.0.1:3000/users
  • http://127.0.0.1:3000/students

使用脚手架

Install moag as Moajs scaffold

$ [sudo] npm install --global moag
$ cd <your-project-name>
$ moag <model-name> name:string password:string -k
  • for koa 2 common function
$ moag user name:string password:string -k
  • for koa2 generator
$ moag book name:string password:string -k -g
  • for koa2 async/await
$ moag cup name:string password:string -k -a

开启async/await

async/await需要babel,所以使用runkoa可以暂时作为开发用,不建议产品环境使用。

$ npm run async

Moajs微信用户组

如果加不上,请加微信shiren1118,说明加入原因

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

版本历史

  • v1.0.0 初始化版本,以Koa 2.x为基础

欢迎fork和反馈

如有建议或意见,请在issue提问或邮件

License

this repo is released under the MIT License.