{"id":15497367,"url":"https://github.com/heapwolf/paramify","last_synced_at":"2025-04-22T21:43:15.930Z","repository":{"id":8767929,"uuid":"10452643","full_name":"heapwolf/paramify","owner":"heapwolf","description":"Parameterized routes without a big bloated router, e.g. \"showtimes/:start/:end\" and \"files/*\"","archived":false,"fork":false,"pushed_at":"2017-07-12T13:12:29.000Z","size":16,"stargazers_count":84,"open_issues_count":0,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-19T07:56:21.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heapwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-03T10:52:11.000Z","updated_at":"2023-10-06T20:56:01.000Z","dependencies_parsed_at":"2022-09-19T04:30:22.582Z","dependency_job_id":null,"html_url":"https://github.com/heapwolf/paramify","commit_stats":null,"previous_names":["hij1nx/paramify"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fparamify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fparamify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fparamify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fparamify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heapwolf","download_url":"https://codeload.github.com/heapwolf/paramify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250330308,"owners_count":21412961,"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-02T08:33:13.247Z","updated_at":"2025-04-22T21:43:15.908Z","avatar_url":"https://github.com/heapwolf.png","language":"JavaScript","readme":"[![development sponsored by voltra.co](https://img.shields.io/badge/Development%20sponsored%20by-Voltra.co-yellow.svg)](https://voltra.co/)\n\n# SYNOPSIS\nParses urls so you can \"route\"\n\n# MOTIVATION\nFor when you want url parameters but not a big bloated router\n\n# USAGE\n```js\nvar fs = require('fs')\nvar http = require('http')\nvar paramify = require('paramify')\n\nhttp.createServer(function (req, res) {\n\n  var match = paramify(req.url)\n  res.writeHead(200, {'Content-Type': 'text/plain'})\n\n  if (match('intro/:greeting')) {\n\n    intro(match.params, res)\n  }\n  else if (match('showtimes/:start/:end')) {\n\n    showtimes(match.params, res)\n  }\n  else if (match('files/*')) {\n  \n    serveFile(match.params, res)\n  }\n  \n}).listen(1337, '127.0.0.1')\n\nfunction intro(params, res) {\n\n  res.end('Greeting was \"' + params.greeting + '\"\\n')\n}\n\nfunction showtimes(params, res) {\n\n  var message = [\n    'Show starts at', params.start, \n    'and ends at', params.end\n  ].join(' ') + '\\n'\n\n  res.end(message)\n}\n\nfunction serveFile(params, res) {\n  // match.params contains numeric keys for any\n  // path components matched with *\n  fs.createReadStream(__dirname + '/static/' + params[0]).pipe(res)\n}\n\n\nconsole.log('Server running at http://127.0.0.1:1337/')\n```\n\nGiven the following url\n```\nhttp://localhost:1337/showtimes/10:00AM/8:30PM\n```\n\nThe server would respond with\n```\nShow starts at 10:00AM and ends at 8:30PM\n```\n\nGiven the following url\n```\nhttp://localhost:1337/intro/Hello%20world!\n```\n\nThe server would respond with\n```\nGreeting was \"Hello world!\"\n```\n\nGiven the following url\n```\nhttp://localhost:1337/files/users/1/description.txt\n```\n\nThe server would respond with the contents of `static/users/1/description.txt`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Fparamify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheapwolf%2Fparamify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Fparamify/lists"}