Socket
Socket
Sign inDemoInstall

advanced

Package Overview
Dependencies
141
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    advanced

A simple MVC framework based on Express


Version published
Weekly downloads
6
decreased by-53.85%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Advanced

A simple MVC framework based on Express

Install

npm install advanced -g

Create an application

# create demo
advanced new app
# install app
cd app
npm install
# start app
node server.js

Visit http://localhost:8586

Create a controller

Controllers are placed in app/controllers.

For example app/controllers/test.js:

var Controller = require('advanced').Controller;

module.exports = Controller.extend({
    index: function() {
        this.res.send('Hello World!');
    }
});

Visit http://localhost:8586/test

Router

Router inherits Router of Express. But there are some enhanced features.

Custom router

You can use a string to specify a controller and a method. i.e. controller@method

In app/routes.js

var Router = require('advanced').Router,
    router = Router();

// a string to specify a controller and a method. i.e. controller@method
router.get('/test/add/:id(\\d+)', 'test@addTest');

module.exports = router;

Default router

A simple router based on file of controller is supported.

If doesn't match any custom router, it will go here.

For example:

req.path = '/this/is/a/path'
  1. is exists /this/is/a/path/index.js@index
  2. is exists /this/is/a/path.js@index
  3. is exists /this/is/a.js@path
  4. is exists /this/is.js@a, this.req.params[0] = 'path'

FAQs

Last updated on 11 May 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc