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

yog2

v1.7.5

Published

Front End Integrated Solution for node express.

Downloads

189

Readme

YOG2

yog2 是一个专注于 Node.js UI 中间层的应用框架。它基于 express 和 fis 开发,在享受 express 的灵活扩展能力和 fis 强大的前端工程化能力的同时,引入了自动路由、app 拆分以及后端服务管理模块来保证UI中间层的快速开发与稳定可靠。


兼容性

  • [x] node 0.8.x
  • [x] node 0.10.x
  • [x] node 0.12.x
  • [x] io.js

同时支持 fis 与 fis3 两种编译核心

入门指引

安装yog2

需要先安装 node.

npm install -g yog2

创建project

yog2 project是基础的运行框架,提供一些基础的配置和中间件管理。通过使用 yog2 提供的脚手架,可以快速创建一个基础的 yog2 project

yog2 init project
# prompt: Enter your project name:  (yog)

创建app

yog2 app 是应用的业务代码,每一个 app 都是一个独立的子项目,包含了这个子项目中所有的前后端代码。我们可以利用 yog2 release 功能将 app 发布至 yog2 project 中来运行 app。

利用 yog2 的 app 拆分能力,我们可以将一个中大型规模的项目按照功能或业务划分为多个独立的 app ,每个 app 均可以独立开发、编译、部署。当项目的业务较简单时,也可以只使用一个 app 来管理代码。

yog2 init app
# prompt: Enter your app name:  (home)

开发调试

安装依赖

首先我们需要为 yog2 project 安装执行必须的依赖

# 进入 yog project 目录
cd yog 
npm install

启动框架

然后我们就可以用开发调试模式启动 yog2 project,让运行框架可用

切勿在生产环境使用开发调试模式启动 yog2 project,这样的行为将会引发安全问题。

yog2 run

yog2 project 的默认端口是 8085,你可以通过修改 PORT 环境变量或者直接修改 app.js 来指定端口。

此时如果我们访问 http://127.0.0.1:8085 由于我们并未部署应用,我们只会得到一个 404 页面。因此下一步我们就需要部署 app。

部署app

由于启动 yog2 project 后会一直占用控制台,因此我们需要另外开启一个控制台去部署 app。

# 进入home目录
cd home
yog2 release --dest debug

yog2 release --dest debug 必须要求运行框架以调试模式启动后使用,否则无法正确的部署代码。

再次访问 http://127.0.0.1:8085 我们就会看到网站已经正常提供服务了。

此外,如果我们在执行 yog2 release 命令时添加 --watch 参数,yog2 就会监听文件修改,并自动部署至 yog2 project 。通过 yog2 的热更新技术,只要是 app 中的代码,无论是静态资源还是后端模板亦或是后端逻辑,均无需重启 yog2 project 就可以生效。

yog2 release --dest dev --watch

文档

请查阅 官网