New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

active

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

active

Cool, simple and fast web framework

  • 0.0.7
  • unpublished
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Installation

$ npm install active

Quick start

var active = require('active');
var app = active();

app.addRoute({
    'url': '/'
}, function(req, res) {
    res.statusCode = 200;
    res.end(content);
});

app.startServer({
    'port': 80,
    'host': 'localhost',
    'cluster': true
});

Routing

Examples of application routes.

app.addRoute({
    'url': '/{category}',
    'match': {
        'category': ['phones', 'stuff']
    }
}, callback);

app.addRoute({
    'url': '/{category}/{item}',
    'match': {
        'category': ['phones', 'stuff'],
        'item': '([a-z0-9-]{2,63}\.[a-z]{4})'
    }
}, callback);

Callbacks

Helpful information about callbacks.

Request parameters

You can use path parameters, which been set in route ("url" directive):

app.addRoute({
    'url': '/{category}/{item}',
    'match': {
        'category': ['phones', 'stuff'],
        'item': '([a-z0-9-]{2,63}\.[a-z]{4})'
    }
}, function(req, res) {
    console.log(req.params); // {category: String, item: String}
});

Response

You can choose how to return result to the client. Below you can see both examples.

Standart

Use standard capabilities of Node using "res" object:

app.addRoute(route, function(req, res) {
    res.statusCode = 200;
    res.end(content);
});
Custom

Use custom capabilities of framework:

app.addRoute(route, function(req, res) {
    res.html(http_code, content);
});

License

The Active JS framework is open-source software licensed under the MIT

Keywords

FAQs

Package last updated on 04 Feb 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc