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

nodelich

v1.1.2

Published

This is very Lightweight Framework of NodeJS

Downloads

7

Readme

项目介绍

  • NodeLich是一个使用NodeJS开发的轻量级的MVC框架,实现了路由转发,模块渲染,MVC等。

安装

$ npm install nodelich

特色

  • 非常轻量级MVC
  • 强大而自由的配置
  • PATH INFO路由映射

快速上手

现在你就可以获得noelich,你需要做的事情是:

$ npm install nodelich

如何开始

  • 建立一个app.js文件,内容如下
var boot = require('./lib/boot');

var config = {
   'PORT': '8080',
   'VIEW_TPL_EXT_NAME': 'html',
   'CONTROLLER_PATH': '../../../controllers/',//controller dir
   'VIEW_PATH': '../../../views/',//view dir
   'LAYOUT_PATH': '../../../views/layout/'//layout dir

};
console.log('NodeLich server listen on 127.0.0.1 port=' + config.PORT + ' ... ... ');

boot.run(config);

$ node app.js


- 建立一个控制器位于/controllers/下(这是可配置的,后面会介绍)
/controllers/IndexController.js

内容如下:

 ```js
function indexAction(res,req){

	var view={};
	return view;

}

exports.indexAction=indexAction;
  • 接下来为IndexController建立一个视图,位于/views/index
<b>Hello NodeLich!</b>

OK 所有的工作到目前为止就结束了,通过访问127.0.0.1:8080/index/index可以看到第一个Hello程序!很酷是吧!


配置

NodeLich 功能是可以配置的,包括侦听的端口号等。下面列出常见的配置。


  • PORT HTTP侦听端口
  • CONTROLLER_PATH 控制器存放路径(注意现在是相对于nodelich源里面的router.js的路径,以后会调整~)
  • VIEW_PATH 视图存放路径
  • LAYOUT_PATH layout存放路径
  • VIEW_TPL_EXT_NAME 模板后缀,默认为.html文件
  • CONTROLLER_EXT 控制器文件名EXT,默认为Controller,Index控制器为IndexController
  • ACTION_EXT Action的EXT,默认为Action,index控制器为indexAction

License

MIT