{"id":16049073,"url":"https://github.com/alexindigo/agnostic","last_synced_at":"2025-03-18T04:31:05.966Z","repository":{"id":57174550,"uuid":"65220127","full_name":"alexindigo/agnostic","owner":"alexindigo","description":"A node library that allows other projects to be agnostic of particular http server implementation","archived":false,"fork":false,"pushed_at":"2020-09-03T23:24:58.000Z","size":38,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T17:05:57.730Z","etag":null,"topics":["agnostic","byos","express","hapi","http","library","nodejs","restify","server","web","wrapper"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/agnostic","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexindigo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-08T16:23:19.000Z","updated_at":"2020-06-22T03:41:43.000Z","dependencies_parsed_at":"2022-08-28T20:50:14.486Z","dependency_job_id":null,"html_url":"https://github.com/alexindigo/agnostic","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexindigo%2Fagnostic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexindigo%2Fagnostic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexindigo%2Fagnostic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexindigo%2Fagnostic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexindigo","download_url":"https://codeload.github.com/alexindigo/agnostic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244156620,"owners_count":20407539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agnostic","byos","express","hapi","http","library","nodejs","restify","server","web","wrapper"],"created_at":"2024-10-09T00:13:07.465Z","updated_at":"2025-03-18T04:31:05.299Z","avatar_url":"https://github.com/alexindigo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# agnostic [![NPM Module](https://img.shields.io/npm/v/agnostic.svg?style=flat)](https://www.npmjs.com/package/agnostic)\n\nA library that allows other projects to be agnostic of particular http server implementation.\n\n[![Linux Build](https://img.shields.io/travis/alexindigo/agnostic/master.svg?label=linux:0.12-6.x\u0026style=flat)](https://travis-ci.org/alexindigo/agnostic)\n[![MacOS Build](https://img.shields.io/travis/alexindigo/agnostic/master.svg?label=macos:0.12-6.x\u0026style=flat)](https://travis-ci.org/alexindigo/agnostic)\n[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/agnostic/master.svg?label=windows:0.12-6.x\u0026style=flat)](https://ci.appveyor.com/project/alexindigo/agnostic)\n\n[![Coverage Status](https://img.shields.io/coveralls/alexindigo/agnostic/master.svg?label=code+coverage\u0026style=flat)](https://coveralls.io/github/alexindigo/agnostic?branch=master)\n[![Dependency Status](https://img.shields.io/david/alexindigo/agnostic/master.svg?style=flat)](https://david-dm.org/alexindigo/agnostic)\n[![bitHound Overall Score](https://www.bithound.io/github/alexindigo/agnostic/badges/score.svg)](https://www.bithound.io/github/alexindigo/agnostic)\n\n\u003c!-- [![Readme](https://img.shields.io/badge/readme-tested-brightgreen.svg?style=flat)](https://www.npmjs.com/package/reamde) --\u003e\n\n*Notice of change of ownership: Starting version 1.0.0 this package has changed it's owner and goals. Old version (0.0.0) is still available on npm via `npm install agnostic@0.0.0` or on [github](https://github.com/dtudury/agnostic). Thank you.*\n\n\n| node / libs |  express | restify        | hapi                                         | http |\n| :--         | :--      | :--            | :--                                          | :--  |\n| v0.12       | 3.x, 4.x |  2.x, 3.x, 4.x | 8.x, 9.x, 10.x                               |  ✓   |\n| io.js       | 3.x, 4.x |  2.x, 3.x, 4.x | 8.x, 9.x, 10.x                               |  ✓   |\n| v4          | 3.x, 4.x |  2.x, 3.x, 4.x | 8.x, 9.x, 10.x, 11.x, 12.x, 13.x, 14.x, 15.x |  ✓   |\n| v5          | 3.x, 4.x |  2.x, 3.x, 4.x | 8.x, 9.x, 10.x, 11.x, 12.x, 13.x, 14.x, 15.x |  ✓   |\n| v6          | 3.x, 4.x |  2.x, 3.x, 4.x | 8.x, 9.x, 10.x, 11.x, 12.x, 13.x, 14.x, 15.x |  ✓   |\n\n\n## Install\n\n```\nnpm install --save agnostic\n```\n\n## Example\n\n### Your Library\n\n```javascript\nvar agnostic = require('agnostic');\n\nmodule.exports = agnostic(myRequestHandler);\n\n/**\n * Does cool things\n *\n * @param {EventEmitter} request - request object, mimicking IncomingMessage\n * @param {Function} respond - callback to respond to the request\n */\nfunction myRequestHandler(request, respond)\n{\n  // do cool things\n  // `request.body` - parsed request body\n  // `request.query` - parsed query string\n  // `respond` is a function with the following signature:\n  // `respond([code], [content[, options]]);`\n  respond(200, 'Received hit to ' + request.url, {headers: {'X-Powered-By': 'AllCoolThings'}});\n}\n```\n\n### Express [![express](https://img.shields.io/badge/express-3.x--4.x-brightgreen.svg?style=flat)](http://expressjs.com)\n\n```javascript\nvar express = require('express');\nvar coolLib = require('above-cool-lib');\n\nvar app = express();\n\napp.all('/my-endpoint', coolLib);\n\n// start the server\napp.listen(1337);\n```\n\n### Restify [![restify](https://img.shields.io/badge/restify-2.x--4.x-brightgreen.svg?style=flat)](http://restify.com)\n\n\n```javascript\nvar restify = require('restify');\nvar coolLib = require('above-cool-lib');\n\nvar server = restify.createServer();\n\nserver.get('/my-endpoint', coolLib);\nserver.post('/my-endpoint', coolLib);\n\n// start the server\nserver.listen(1337);\n```\n\n### Hapi [![hapi](https://img.shields.io/badge/hapi-8.x--15.x-brightgreen.svg?lstyle=flat)](http://hapijs.com)\n\n```javascript\nvar Hapi = require('hapi');\nvar coolLib = require('above-cool-lib');\n\nvar server = new Hapi.Server();\n\n// setup hapi server\nserver.connection({ port: 1337 });\n\nserver.route({\n  method : ['GET', 'POST'], // Hapi uses GET handler for HEAD requests\n  path   : '/my-endpoint',\n  handler: coolLib\n});\n\n// start the server\nserver.start();\n\n```\n\n### http [![http](https://img.shields.io/badge/http-0.12.x--6.x-brightgreen.svg?style=flat)](https://nodejs.org/api/http.html)\n\n```javascript\n  var http    = require('http');\n  var coolLib = require('above-cool-lib');\n\n  server = http.createServer(coolLib);\n\n  // start the server\n  server.listen(1337);\n```\n\n## Want to Know More?\n\nMore examples can be found in [test folder](test/).\n\nOr open an [issue](https://github.com/alexindigo/agnostic/issues) with questions and/or suggestions.\n\n## License\n\nAgnostic is released under the [MIT](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexindigo%2Fagnostic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexindigo%2Fagnostic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexindigo%2Fagnostic/lists"}