4.0.0 • Published 2 years ago

architect-restify v4.0.0

Weekly downloads
5
License
Apache-2.0
Repository
github
Last release
2 years ago

architect-restify build status NPM version

expose restify server rest as architect plugin.

Installation

npm install --save architect-restify

Config Format

{
  "packagePath": "architect-restify",
  port: process.env.PORT || 8080,
  host: process.env.IP || "0.0.0.0"
}

Or With plugins :

{
  packagePath: "architect-restify",
  port: process.env.PORT || 8080,
  host: process.env.IP || "0.0.0.0"
  plugins: {
    bodyParser : {
      mapParams : false
    }
  }
}

Usage

Boot Architect :

var path = require('path');
var architect = require("architect");

var configPath = path.join(__dirname, "config.js");
var config = architect.loadConfig(configPath);

architect.createApp(config, function (err, app) {
    if (err) {
        throw err;
    }
    console.log("app ready");
});

Configure Architect with config.js :

module.exports = [{
    packagePath: "architect-restify",
    port: process.env.PORT || 8080,
    host: process.env.IP || "0.0.0.0"
}, './routes'];

And register your routes in ./routes/index.js :

module.exports = function setup(options, imports, register) {
    var rest = imports.rest;

    // register routes 
    rest.get('/catalogue', function (req, res, next) {
        res.write("{'message':'hello, world'}");
	res.end();
    });
    
    register();
};
// Consume rest plugin
module.exports.consumes=['rest'];

Options

  • port : tcp port to listent to
  • host : host to listen to
  • socket: unix socket to listen
  • interface : network interface name to listen to (must match os.networkInterfaces)
  • family : interface address family to listen to (with interface)
  • plugins: a hash containing either a restify bundled plugin or a function that returns a plugin.
4.0.0

2 years ago

3.2.4

3 years ago

3.2.3

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

4 years ago

3.1.0

5 years ago

3.0.1

6 years ago

2.0.1

6 years ago

1.1.0

6 years ago

1.0.0

8 years ago

0.6.0

9 years ago

0.5.1

9 years ago

0.4.4

9 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.1

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago

0.0.1

11 years ago