alamid-api
abstracting http/websockets requests
Last updated 6 years ago by peerigon .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install alamid-api 
SYNC missed versions from official npm registry.

Abstracting different transports (http/websockets) and libraries to a unite them all.

browser support Build Status Dependency Status

Usage

var api = require("alamid-api"),

var router = api.router();

//attach your universal routes
router.get("/hello", function(req, res, next) {
    res.end("You can use me via ws and http!");
});

var app = express(),
    server = http.createServer(app),
    io = socketIO.listen(server);

//with connect/express app
alamidRequest.use(require("alamid-api/plugins/connect"), { app: app });

//with http.Server
alamidRequest.use(require("alamid-api/plugins/http"), { server: server });

//with socket.io
alamidRequest.use(require("alamid-api/plugins/socket.io"), { io: io });

Plugins

Enhanced Response


api.use(require("alamid-api/plugins/enhancedResponse"));

API

  • res.send(statusCode?, response)
  • res.success(data)
  • res.fail(code)
  • res.error(code)

Browser Integration Tests

Use testling to run the integration test in your favourite browser.

Examples

  • Google Chrome on OSX ./node_modules/.bin/testling -x /usr/bin/open -a "/Applications/Google Chrome.app"
  • Default browser on OSX./node_modules/.bin/testling -u

Current Tags

  • 0.3.4                                ...           latest (6 years ago)

6 Versions

  • 0.3.4                                ...           6 years ago
  • 0.3.3                                ...           6 years ago
  • 0.3.2                                ...           6 years ago
  • 0.3.1                                ...           6 years ago
  • 0.2.1                                ...           6 years ago
  • 0.2.0                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (10)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |