{"id":20199921,"url":"https://github.com/fortunejs/fortune-json-api","last_synced_at":"2025-04-09T12:04:18.575Z","repository":{"id":36451982,"uuid":"40757047","full_name":"fortunejs/fortune-json-api","owner":"fortunejs","description":"JSON API serializer for Fortune.","archived":false,"fork":false,"pushed_at":"2024-02-21T02:23:01.000Z","size":196,"stargazers_count":65,"open_issues_count":7,"forks_count":28,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-02T03:35:03.914Z","etag":null,"topics":["json-api","json-api-serializer"],"latest_commit_sha":null,"homepage":null,"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/fortunejs.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":"2015-08-15T12:04:23.000Z","updated_at":"2024-11-18T11:45:11.000Z","dependencies_parsed_at":"2024-02-21T03:44:04.090Z","dependency_job_id":null,"html_url":"https://github.com/fortunejs/fortune-json-api","commit_stats":{"total_commits":100,"total_committers":19,"mean_commits":"5.2631578947368425","dds":0.49,"last_synced_commit":"d7210704d8294e432b429204cf4fd4b1db89f0f0"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunejs%2Ffortune-json-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunejs%2Ffortune-json-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunejs%2Ffortune-json-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortunejs%2Ffortune-json-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fortunejs","download_url":"https://codeload.github.com/fortunejs/fortune-json-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036064,"owners_count":21037092,"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":["json-api","json-api-serializer"],"created_at":"2024-11-14T04:40:32.439Z","updated_at":"2025-04-09T12:04:18.536Z","avatar_url":"https://github.com/fortunejs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fortune JSON API Serializer\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/fortunejs/fortune-json-api/test.yml)\n[![npm Version](https://img.shields.io/npm/v/fortune-json-api.svg?style=flat-square)](https://www.npmjs.com/package/fortune-json-api)\n[![License](https://img.shields.io/npm/l/fortune-json-api.svg?style=flat-square)](https://raw.githubusercontent.com/fortunejs/fortune-json-api/master/LICENSE)\n\nThis is a [JSON API](http://jsonapi.org) serializer for [Fortune.js](http://fortune.js.org/), which implements all of the features in the [base specification](http://jsonapi.org/format/), and follows the [recommendations](http://jsonapi.org/recommendations/) as much as possible.\n\n```sh\n$ npm install fortune fortune-http fortune-json-api\n```\n\n\n## Usage\n\n```js\nconst http = require('http')\nconst fortune = require('fortune')\nconst fortuneHTTP = require('fortune-http')\nconst jsonApiSerializer = require('fortune-json-api')\n\n// `instance` is an instance of Fortune.js.\nconst listener = fortuneHTTP(instance, {\n  serializers: [\n    // The `options` object here is optional.\n    [ jsonApiSerializer, options ]\n  ]\n})\n// The listener function may be used as a standalone server, or\n// may be composed as part of a framework.\nconst server = http.createServer((request, response) =\u003e\n  listener(request, response)\n  .catch(error =\u003e { /* error logging */ }))\n\nserver.listen(8080)\n```\n\nThe `options` object is as follows:\n\n- `prefix`: hyperlink prefix. If this prefix starts with `/`, then it will rewrite paths relative to the prefix. For example, a prefix valued `/api` will handle requests at that route like `/api/users/1`. Default: `\"\"` (empty string).\n- `inflectType`: pluralize and dasherize the record type name in the URI. Can be Boolean to enable/disable all inflections or an object specifying each type in specific with unreferenced types set to default, ex: `{ faculty: false }`. Default: `true`.\n- `inflectKeys`: camelize the field names per record. Default: `true`.\n- `maxLimit`: maximum number of records to show per page. Default: `1000`.\n- `includeLimit`: maximum depth of fields per include. Default: `3`.\n- `bufferEncoding`: which encoding type to use for input buffer fields. Default: `base64`.\n- `jsonSpaces`: how many spaces to use for pretty printing JSON. Default: `2`.\n- `jsonapi`: top-level object mainly used for describing version. Default: `{ version: '1.0' }`.\n- `castNumericIds`: whether to cast numeric id strings to numbers. Default: `true`.\n\nInternal options:\n\n- `uriTemplate`: URI template string.\n- `allowLevel`: HTTP methods to allow ordered by appearance in URI template.\n\n\n## License\n\nThis software is licensed under the [MIT license](https://raw.githubusercontent.com/fortunejs/fortune-json-api/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortunejs%2Ffortune-json-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffortunejs%2Ffortune-json-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortunejs%2Ffortune-json-api/lists"}