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

nodeframe

v0.2.0

Published

A modular web application framework based-on popular node technologies (express, swig and etc.).

Downloads

7

Readme

Nodeframe

A modular web application framework based-on popular node technologies (express, swig and etc.).

License

MIT

Latest version

0.2.0


Quick Start

1). Bootstrapping nodeframe.

  1. Write a "package.json" file as below.

     {      
         "name": "Project Name",  
         "version": "0.0.1",  
         "private": true,  
         "scripts": {  
             "start": "node app-server.js"  
         },  
         "dependencies": {  
             "nodeframe": "*"  
         }  
     }  
  2. Run "npm install" under the same directory with "package.json".

  3. Write a "app-server.js" file as below.

     require('nodeframe').start();
  4. Run "node app-server.js".

  5. Try visit http://localhost:3000

2). Create a new web module.

  1. Create a module directory "hello_nodeframe" under the "web_modules" directory which is automatically created by previous operations.

  2. Write a "bootstrap.js" as below under the newly created directory.

     module.exports = {
    
         version: '0.0.1', // the version of the new module
    
         routes: { // routes settings
    
             '/': {
                 rule: { // router type, currently supports rule/mvc/rest
                     rules: { // required for rule based router
                         '/': { // sub-path
                             get: 'home.index' // http method and controller action
                         }
                     }
                 }
             }
    
         }
     };
  3. Create a controllers directory "controllers" under the "hello_nodeframe" directory.

  4. Write the controller file "home.js" as below under the "controllers" directory.

     module.exports = {
         index: function (router) { // controller action
    
             router.appendViewData({
                 title: 'Hello nodeframe!'
             });
    
             // to render "index" view template, modify router.view to render other template
             router.renderResponse();
         }
     };
  5. Create a views directory "views" under the "hello_nodeframe" directory.

  6. Write the view template "home_index.swig" as below under the "views" directory.

     {{ title }}
  7. Update the "etc/development.js" file that generated by 1) as below to enable the new module.

    module.exports = {
    
        modules: {
            hello_nodeframe: {
                route: '/hello' // can be whatever path you want, e.g. /test, /module1
            }
        }
    };
  8. Run "node app-server.js" again.

  9. Try visit http://localhost:3000/hello

3). Create a wechat module.

  1. Create a module directory "hello_wechat" under the "web_modules" directory.

  2. Write a "bootstrap.js" as below under the "hello_wechat" directory.

     module.exports = {
    
         version: '0.0.1', // the version of the new module
    
         routes: { // routes settings
    
             '/': {
                 rule: { // router type, currently supports rule/mvc/rest
                        
                     rules: { // required for rule based router
                         '/': 'wechat.service'
                     }
                 }
             }
    
         },
            
         middlewares: {
             'wechat': {
                 token: 'your_wechat_token_here'
             }
         }
     };
  3. Create a controllers directory "controllers" under the "hello_wechat" directory.

  4. Write the controller file "wechat.js" as below under the "controllers" directory.

     module.exports = {
         service: function (router) {
             var message = router.req.weixin;
    	
             if (message.MsgType === 'event') {
    	
                 if (message.Event === 'subscribe') {
                     return router.res.reply('Welcome to subscribe!');
                 }
    	
                 return router.res.reply('I am fine.');
             }
    	
             if (message.MsgType === 'text') {
                 return router.res.reply(message.Content);
             }
    	
             router.res.reply('Hi');
         }
     };
  5. Update the "etc/development.js" file that generated by 1) as below to enable the new module.

    module.exports = {
    
        wechat: {},
    
        modules: {
            hello_nodeframe: {
                route: '/hello' // can be whatever path you want, e.g. /test, /module1
            },
               
            hello_wechat: {
                route: '/wechat' // can be whatever path you want, e.g. /test, /module1
            }
        }
    };
  6. Run "node app-server.js" again.

  7. Try visit http://localhost:3000/wechat, and you should see "invalid signature".

  8. Now you can use this web module as the back-end application to serve wechat request. (PS: Wechat requires the service to listen on 80 port.)