{"id":16720190,"url":"https://github.com/hsynlms/express-prettier","last_synced_at":"2026-05-06T02:39:09.907Z","repository":{"id":51306053,"uuid":"273173115","full_name":"hsynlms/express-prettier","owner":"hsynlms","description":"A simple and lightweight beautifier plugin for Express.","archived":false,"fork":false,"pushed_at":"2021-05-22T22:59:09.000Z","size":545,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T11:08:14.456Z","etag":null,"topics":["beautify","express","express-plugin","json","prettier","prettify"],"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/hsynlms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"hsynlms"}},"created_at":"2020-06-18T07:39:23.000Z","updated_at":"2021-05-22T22:59:11.000Z","dependencies_parsed_at":"2022-08-23T22:00:45.068Z","dependency_job_id":null,"html_url":"https://github.com/hsynlms/express-prettier","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hsynlms/express-prettier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsynlms%2Fexpress-prettier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsynlms%2Fexpress-prettier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsynlms%2Fexpress-prettier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsynlms%2Fexpress-prettier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsynlms","download_url":"https://codeload.github.com/hsynlms/express-prettier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsynlms%2Fexpress-prettier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268448204,"owners_count":24251999,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["beautify","express","express-plugin","json","prettier","prettify"],"created_at":"2024-10-12T22:06:09.319Z","updated_at":"2025-10-30T21:16:01.544Z","avatar_url":"https://github.com/hsynlms.png","language":"JavaScript","funding_links":["https://github.com/sponsors/hsynlms"],"categories":[],"sub_categories":[],"readme":"# express-prettier\n\u003e A simple and lightweight beautifier plugin for [Express](https://github.com/expressjs/express).\n\n[![Downloads](https://img.shields.io/npm/dm/express-prettier.svg)](https://npmjs.com/express-prettier)\n[![install size](https://packagephobia.com/badge?p=express-prettier)](https://packagephobia.com/result?p=express-prettier)\n\n`express-prettier` has support of beautifying payloads via query parameter to make responses more readable for developers/humans. The plugin itself uses [prettier](https://github.com/prettier/prettier) under the hood and is capable of parsing/formatting anything that prettier can.\n\n`express-prettier` registers itself as an express `middleware` to beautify the response payload before it gets sent.\n\n**Note:** `streams` and `buffers` are excluded in beautification process.\n\n## Install\n```\n$ npm install express-prettier\n```\n\n## Usage\n\n```js\nconst app = require('express')()\nconst expressPrettier = require('express-prettier')\n\napp.use(\n  expressPrettier(\n    { fallbackOnError: false }\n  )\n)\n\napp.get('/', (req, res) =\u003e {\n  const obj = {\n    blackLivesMatter: true,\n    favSinger: 'Ahmet Kaya'\n  }\n\n  res.setHeader('content-type', 'application/json')\n  res.send(obj)\n})\n\napp.listen(3000, () =\u003e {\n  console.log('Express server is running on port: 3000')\n})\n\n// -------------------------------\n\n// http://localhost:3000 -\u003e will print out below result\n/*\n{\"blackLivesMatter\":true,\"favSinger\":\"Ahmet Kaya\"}\n*/\n\n// http://localhost:3000?pretty=true -\u003e will print out below result\n/*\n{\n  \"blackLivesMatter\": true,\n  \"favSinger\": \"Ahmet Kaya\"\n}\n*/\n```\n\nYou are allowed to change the query parameter option.\n\n```js\napp.use(\n  expressPrettier(\n    {\n      query: {\n        name: 'beautify',\n        value: 'yes'\n      }\n    }\n  )\n)\n\n// -------------------------------\n\n// http://localhost:3000 -\u003e will print out below result\n/*\n{\"blackLivesMatter\":true,\"favSinger\":\"Ahmet Kaya\"}\n*/\n\n// http://localhost:3000?beautify=yes -\u003e will print out below result\n/*\n{\n  \"blackLivesMatter\": true,\n  \"favSinger\": \"Ahmet Kaya\"\n}\n*/\n```\n\nYou can enable beautification for all outgoing payloads regardless the query parameter.\n\n```js\napp.use(\n  expressPrettier(\n    { alwaysOn: true }\n  )\n)\n\n// -------------------------------\n\n// http://localhost:3000 -\u003e will print out below result\n/*\n{\n  \"blackLivesMatter\": true,\n  \"favSinger\": \"Ahmet Kaya\"\n}\n*/\n```\n\n## Options\n\n| Name                   | Type       | Default                                     | Description                                                                    |\n| ---                    | ---        | ---                                         | ---                                                                            |\n| alwaysOn               | boolean    | false                                       | To make all the payloads beautified in anyway                                  |\n| fallbackOnError        | boolean    | true                                        | If something bad happens, send the original payload. If its `false`, an error will be thrown |\n| overrideContentLength  | boolean    | true                                        | Re-calculate `content-length` header for the beautified response               |\n| query                  | object     | `{ name: 'pretty', value: 'true' }`         | The query parameter that triggers the plugin to beautify the outgoing payload  |\n| prettierOpts           | object     | `{ tabWidth: 2, parser: 'json-stringify' }` | Please take a look prettier [official documentation](https://prettier.io/docs/en/options.html) for more information |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsynlms%2Fexpress-prettier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsynlms%2Fexpress-prettier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsynlms%2Fexpress-prettier/lists"}