{"id":21529373,"url":"https://github.com/ramsunvtech/apicluster","last_synced_at":"2025-04-09T23:51:19.069Z","repository":{"id":57182021,"uuid":"45934646","full_name":"ramsunvtech/apicluster","owner":"ramsunvtech","description":"API Endpoint Library - API Cluster is free and open source Javascript library for organizing endpoint in efficient way.","archived":false,"fork":false,"pushed_at":"2016-02-22T14:52:09.000Z","size":79,"stargazers_count":7,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T01:42:37.296Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://apicluster.js.org/","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/ramsunvtech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-10T19:19:19.000Z","updated_at":"2020-12-16T10:19:08.000Z","dependencies_parsed_at":"2022-09-12T23:50:26.610Z","dependency_job_id":null,"html_url":"https://github.com/ramsunvtech/apicluster","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramsunvtech%2Fapicluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramsunvtech%2Fapicluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramsunvtech%2Fapicluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramsunvtech%2Fapicluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ramsunvtech","download_url":"https://codeload.github.com/ramsunvtech/apicluster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247640508,"owners_count":20971553,"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":[],"created_at":"2024-11-24T01:57:06.743Z","updated_at":"2025-04-09T23:51:19.048Z","avatar_url":"https://github.com/ramsunvtech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg height=\"240\" width=\"235\" src=\"https://github.com/ramsunvtech/apicluster/raw/master/api-cluster.png\"\u003e\n\u003c/p\u003e\n\n# Api Cluster\n**Endpoint Library**\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url]\n\u003c!--[![Coverage Status](https://coveralls.io/repos/ramsunvtech/apicluster/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/ramsunvtech/apicluster?branch=master) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ramsunvtech/apicluster?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)--\u003e\n\n[![NPM](https://nodei.co/npm/apicluster.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/apicluster/)\n\n[downloads-image]: http://img.shields.io/npm/dm/apicluster.svg\n[npm-url]: https://npmjs.org/package/apicluster\n[npm-image]: http://img.shields.io/npm/v/apicluster.svg\n\n[travis-url]: https://travis-ci.org/ramsunvtech/apicluster\n[travis-image]: http://img.shields.io/travis/ramsunvtech/apicluster.svg\n\n## What is API Cluster?\nAPI Cluster is free and open source Javascript library for organizing endpoint in efficient way.\n\n## Why API Cluster?\nAdd multiple groups for versioning.  \nQuit messing with concatenation on URL with + operator.  \nAvailable in (Node) Server side and (browser) Client Side.  \n\n# Getting Started\n\n#### 1. Install api cluster globally (server side) or include the apicluster.js in your file.\n\n```sh\n$ npm install --global apicluster\n\u003cscript src=\"ApiCluster.js\"\u003e\u003c/script\u003e\n```\n\n#### 2. Create Config and define endpoints.\n\n```javascript\nApiCluster\n  // Default Group.\n  .defaults({\n      name: 'mydefault',\n\n      config: {\n        'employee': 'emp',\n        'details': 'details',\n        'timesheet': 'timesheet'\n      },\n\n      endpoints: {\n        \"empDetails\": \"_employee_/_details_/:empId/profile\"\n      }\n  });\n```\n\n#### 2. Add multiple endpoints groups.  \n\n```javascript\nApiCluster\n  // Default Group.\n  .defaults({\n      name: 'mydefault',\n\n      config: {\n        'employee': 'emp',\n        'details': 'details',\n        'timesheet': 'timesheet'\n      },\n\n      endpoints: {\n        \"empDetails\": \"_employee_/_details_/:empId/profile\"\n      }\n  })\n  .addAnother({\n      name: 'v1',\n\n      config: {\n        'employee': 'emp/v1',\n        'details': 'detailed',\n        'timesheet': 'timesheet'\n      },\n\n      endpoints: {\n        \"empDetails\": \"_employee_/_details_/:empId/profile\"\n      }\n  })\n  .addAnother({\n      name: 'v2',\n\n      config: {\n        'employee': 'emp/v2',\n        'details': 'detailed',\n        'timesheet': 'timesheet'\n      },\n\n      endpoints: {\n        \"empDetails\": \"_employee_/_details_/:empId/profile\"\n      }\n  });\n```\n\n#### 4. Get your dynamic Endpoint URL from the Configured Endpoint list from Default Group defined in `defaults()` method.  \n\n```javascript\nvar empDetails = ApiCluster\n                  .get('empDetails')\n                  .arg({\n                    'empId': 1000 \n                  })\n                  .query({\n                    'confirm': 'yes',\n                    'testAccount': 'yes'\n                  })\n                  .url();\n```\n```\nExpected Output: emp/details/1000/profile?confirm=yes\u0026testAccount=yes\n```\n\n#### 5. Get Endpoint URL from the Configured Endpoint list from `v1` Group defined in `addAnother()` method.  \n\n```javascript\nvar empDetails = ApiCluster\n                  .use('v1')\n                  .get('empDetails')\n                  .arg({\n                    'empId': 1000 \n                  })\n                  .query({\n                    'confirm': 'yes',\n                    'testAccount': 'yes'\n                  })\n                  .url();\n```\n```\nExpected Output: emp/v1/detailed/1000/profile?confirm=yes\u0026testAccount=yes\n```\n\n## Example on how to use it in Node.\n\n```javascript\nvar http = require('http'),\n\tApiCluster = require('apicluster');\n\nApiCluster\n  // Default Group.\n  .defaults({\n      name: 'mydefault',\n \n      config: {\n        'employee': 'emp',\n        'details': 'details',\n        'timesheet': 'timesheet'\n      },\n \n      endpoints: {\n        \"empDetails\": \"_employee_/_details_/:empId/profile\"\n      }\n  });\n\n//Lets define a port we want to listen to\nconst PORT = 9000; \n\n// Function which handles requests and send response\nfunction handleRequest(request, response) {\n\tvar empDetailURL = ApiCluster\n                  .get('empDetails')\n                  .arg({\n                    'empId': 1000 \n                  })\n                  .query({\n                    'confirm': 'yes',\n                    'testAccount': 'yes'\n                  })\n                  .url();\n    response.end('\u003ch1\u003eGenerated Endpoint URL:\u003cbr\u003e '\n    \t+ empDetailURL + '\u003c/h1\u003e');\n}\n\n//Create a server\nvar server = http.createServer(handleRequest);\n\n//Lets start our server\nserver.listen(PORT, function(){\n    // Callback triggered when server is successfully listening. Hurray!\n    console.log(\"Server listening on: http://localhost:%s\", PORT);\n});\n```\n\n## Want to contribute?\n\nAnyone can help make this project better - check out the [Contributing guide](/CONTRIBUTING.md)!\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ramsunvtech/apicluster/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framsunvtech%2Fapicluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framsunvtech%2Fapicluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framsunvtech%2Fapicluster/lists"}