{"id":17651064,"url":"https://github.com/tilap/api-response","last_synced_at":"2025-03-30T08:27:26.345Z","repository":{"id":30530142,"uuid":"34084714","full_name":"tilap/api-response","owner":"tilap","description":"Express middleware API responses in JSON","archived":false,"fork":false,"pushed_at":"2015-04-26T16:45:23.000Z","size":132,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T10:34:45.465Z","etag":null,"topics":[],"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/tilap.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":"2015-04-16T22:52:12.000Z","updated_at":"2015-04-26T16:44:14.000Z","dependencies_parsed_at":"2022-09-22T12:52:19.690Z","dependency_job_id":null,"html_url":"https://github.com/tilap/api-response","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilap%2Fapi-response","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilap%2Fapi-response/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilap%2Fapi-response/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilap%2Fapi-response/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tilap","download_url":"https://codeload.github.com/tilap/api-response/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246293887,"owners_count":20754341,"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-10-23T11:40:11.221Z","updated_at":"2025-03-30T08:27:26.318Z","avatar_url":"https://github.com/tilap.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Api Response Middleware for express\n\nBasic Express middleware to simply output json response for Api, set the http\nstatus code and a default message if none is provided.\n\nAllow to easily send Api response with that json format:\n\n    {\n        status: 200,\n        message: 'OK',\n        data: {\n            property: 'value'\n        }\n    }\n\nAutomatically add default message depending on the status if none is provided.\n\nMoreover, set the express res status the same as the json response.\n\n## Install\n\nAs it's a very small piece of code, don't think it will be usefull enough to\npush it on npm. So, use the github repo\n\n    npm install git+https://git@github.com/tilap/api-response.git#v1.0.1\n\n## Usecase\n\n    var express = require('express');\n    var app = express();\n\n    var apiResponse = require('api-response');\n\n    app.use( apiResponse.express );\n\n    app.get('/api/ok',function(req,res){\n       res.apiResponse(200, {property: 'value'}, 'A custom message');\n    });\n\n    app.get('/api/ok',function(req,res){\n       res.apiResponse(200, {property: 'value'}, 'A custom message');\n    });\n\n    app.listen(8080);\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftilap%2Fapi-response","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftilap%2Fapi-response","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftilap%2Fapi-response/lists"}