{"id":18318391,"url":"https://github.com/tether/manner","last_synced_at":"2025-04-05T21:32:42.891Z","repository":{"id":73071241,"uuid":"94460581","full_name":"tether/manner","owner":"tether","description":"Create HTTP services in the best possible manner","archived":false,"fork":false,"pushed_at":"2018-09-21T20:18:35.000Z","size":124,"stargazers_count":3,"open_issues_count":27,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T12:11:47.001Z","etag":null,"topics":["api","endpoint","http-method","magic","service"],"latest_commit_sha":null,"homepage":"","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/tether.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-15T16:56:04.000Z","updated_at":"2019-11-10T03:02:55.000Z","dependencies_parsed_at":"2023-08-01T12:15:52.186Z","dependency_job_id":null,"html_url":"https://github.com/tether/manner","commit_stats":{"total_commits":217,"total_committers":1,"mean_commits":217.0,"dds":0.0,"last_synced_commit":"3602da79801f47eb9eeac3f8891ab1bc20fcd6d0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tether%2Fmanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tether%2Fmanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tether%2Fmanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tether%2Fmanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tether","download_url":"https://codeload.github.com/tether/manner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406082,"owners_count":20933803,"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":["api","endpoint","http-method","magic","service"],"created_at":"2024-11-05T18:09:20.893Z","updated_at":"2025-04-05T21:32:42.633Z","avatar_url":"https://github.com/tether.png","language":"JavaScript","readme":"# Manner\n\n[![Build Status](https://travis-ci.org/tether/manner.svg?branch=master)](https://travis-ci.org/tether/manner)\n[![NPM](https://img.shields.io/npm/v/manner.svg)](https://www.npmjs.com/package/manner)\n[![Downloads](https://img.shields.io/npm/dm/manner.svg)](http://npm-stat.com/charts.html?package=manner)\n[![guidelines](https://tether.github.io/contribution-guide/badge-guidelines.svg)](https://github.com/tether/contribution-guide)\n\nQuickly create HTTP services from an object. Manner is framework agnostic and can be plugged to any HTTP server.\n\n  * **know the response type**: Return buffers, streams, promises, objects or any type of primitives. Manner knows your data type and send its content as fast as possible down the HTTP response.\n  * **chunk the response content**: Response are encoded using the chunk transfer protocol. Manner is memory efficient and can manage a large amount of concurrent request.\n  * **decode the request data**: Manner intelligently decode the data sent through the request and supports any kind of encoding (application/x-www-form-urlencoded, multipart/form-data, json, etc).\n  * **manage your service status**: Manner knows what's going on with your response and send the appropriate status code whenever a method has not been implemented, a media type is not supported, etc.\n  * **expose methods**: Access your service methods independently from any HTTP request. Perfect to decouple your API from its implementation.\n  * **schema**: Apply schema to annotate and validate your service(s) (see [test suite](https://github.com/tether/manner/blob/master/test/manner.js))\n\n\n\u003c!-- See [features](#features) for more goodness. --\u003e\n\n\u003c!-- Manner is memory efficient and intelligently destroy. --\u003e\n\n## Usage\n\nCreate a web service from an object:\n\n```javascript\nconst http = require('http')\nconst service= require('manner')\n\nconst db = []\n\nconst api = service({\n  'get': {\n    '/': () =\u003e 'hello you',\n    '/earth': '/world',\n    '/:name': (query) =\u003e `hello ${query.name}!`\n  },\n  'post': (query, data) =\u003e {\n    return db.push(data)\n  }\n})\n\n// HTTP service\nhttp.createServer((req, res) =\u003e {\n  api(req, res).pipe(res)\n})\n\n// Programmatic service\napi.get('/')\n// =\u003e hello you\n\napi.get('/bob')\n// =\u003e hello bob!\n\napi.get('/earth')\n// =\u003e hello world!\n```\n\nand programmaticaly add or call routes\n\n```js\n\nconst api = service({\n  'get': () =\u003e 'hello world'\n})\n\napi.get('/:name', query =\u003e {\n  return `hello ${query.name}!`\n})\n\napi.get('/bob')\n// =\u003e hello bob!\n```\n\n## Installation\n\n```shell\nnpm install manner --save\n```\n\n[![NPM](https://nodei.co/npm/manner.png)](https://nodei.co/npm/manner/)\n\n\u003c!-- ## features\n\n  * mixin request query payload  --\u003e\n\n## Question\n\nFor support, bug reports and or feature requests please make sure to read our\n\u003ca href=\"https://github.com/tether/contribution-guide/blob/master/community.md\" target=\"_blank\"\u003ecommunity guidelines\u003c/a\u003e and use the issue list of this repo and make sure it's not present yet in our reporting checklist.\n\n## Contribution\n\nThe open source community is very important to us. If you want to participate to this repository, please make sure to read our \u003ca href=\"https://github.com/tether/contribution-guide\" target=\"_blank\"\u003eguidelines\u003c/a\u003e before making any pull request. If you have any related project, please let everyone know in our wiki.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Tether Inc\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftether%2Fmanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftether%2Fmanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftether%2Fmanner/lists"}