{"id":23366693,"url":"https://github.com/d8corp/jap-express","last_synced_at":"2025-04-07T23:15:44.162Z","repository":{"id":35175056,"uuid":"216278391","full_name":"d8corp/jap-express","owner":"d8corp","description":"Jap plugin for express","archived":false,"fork":false,"pushed_at":"2023-01-05T05:18:05.000Z","size":500,"stargazers_count":2,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T03:15:50.186Z","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/d8corp.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":"2019-10-19T22:30:59.000Z","updated_at":"2020-10-08T13:58:53.000Z","dependencies_parsed_at":"2023-01-15T15:22:19.380Z","dependency_job_id":null,"html_url":"https://github.com/d8corp/jap-express","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fjap-express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fjap-express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fjap-express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fjap-express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d8corp","download_url":"https://codeload.github.com/d8corp/jap-express/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744328,"owners_count":20988783,"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-12-21T14:17:18.803Z","updated_at":"2025-04-07T23:15:44.123Z","avatar_url":"https://github.com/d8corp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jap/express\n[npm](https://www.npmjs.com/package/jap-express) | [github](https://github.com/d8corp/jap-express)  \nThis is a plugin for [express](https://expressjs.com/) to use [jap](https://www.npmjs.com/package/jap).\n\u003e `japExpress(handler, resolve, reject, start, end, context)`  \n### Simple example \n- Add file `index.js`\n```javascript\nconst express = require('express')\nconst jap = require('jap-express')\n\nconst app = express()\n\napp.get('/', (req, res) =\u003e res.send(''))\napp.post('/', jap({test: true}))\napp.listen(3000)\n```\n- Run the app\n```bash\nnode index.js\n```\n- Open browser with `http://localhost:3000/` and run the next code in console\n```javascript\nfetch('/', {\n  method: 'post',\n  headers: {\n    'Accept': 'application/json',\n    'Content-Type': 'application/json'\n  },\n  body: '{\"test\": null}'\n}).then(data =\u003e data.json()).then(console.log)\n```\n### Classic example \nYou may use classes with `jap`, this is a good way to have separately space for each request  \n- Add `classic.js`\n```javascript\nconst express = require('express')\nconst jap = require('jap-express')\n\nconst app = express()\n\nclass App {\n  constructor (req, res) {\n    this.req = req\n  }\n  userAgent () {\n    return this.req.headers['user-agent']\n  }\n}\n\napp.get('/', (req, res) =\u003e res.send(''))\napp.post('/', jap(App))\napp.listen(3001)\n\n```\n- Run the app\n```bash\nnode classic.js\n```\n- Open browser with `http://localhost:3001/` and run the next code in console\n```javascript\nfetch('/', {\n  method: 'post',\n  headers: {\n    'Accept': 'application/json',\n    'Content-Type': 'application/json'\n  },\n  body: '{\"userAgent\": null}'\n}).then(data =\u003e data.json()).then(console.log)\n```\n### Real example\nYou may look at real example with [jap](https://www.npmjs.com/package/jap):\n```bash\ngit clone https://github.com/d8corp/jap.git\ncd jap\nnpm i\nnpm start\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Fjap-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd8corp%2Fjap-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Fjap-express/lists"}