{"id":22827219,"url":"https://github.com/rm3web/sitepath","last_synced_at":"2025-03-31T00:43:13.766Z","repository":{"id":57362014,"uuid":"48289655","full_name":"rm3web/sitepath","owner":"rm3web","description":"A self-describing URL path-like thing","archived":false,"fork":false,"pushed_at":"2020-05-26T15:00:26.000Z","size":121,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T07:05:15.578Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rm3web.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-19T16:45:25.000Z","updated_at":"2020-06-03T17:21:59.000Z","dependencies_parsed_at":"2022-09-26T16:40:43.717Z","dependency_job_id":null,"html_url":"https://github.com/rm3web/sitepath","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rm3web%2Fsitepath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rm3web%2Fsitepath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rm3web%2Fsitepath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rm3web%2Fsitepath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rm3web","download_url":"https://codeload.github.com/rm3web/sitepath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246399791,"owners_count":20770907,"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-12T18:08:36.745Z","updated_at":"2025-03-31T00:43:13.743Z","avatar_url":"https://github.com/rm3web.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A self-describing URL path-like thing\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/rm3web/sitepath.svg)](https://greenkeeper.io/)\n\n[![Build Status](https://travis-ci.org/rm3web/sitepath.svg?branch=master)](https://travis-ci.org/rm3web/sitepath)\n\nThis is a URL mapping scheme and utility library designed around the [PostgreSQL ltree data type](http://www.postgresql.org/docs/current/static/ltree.html)\n\nOn the database side, you have records accessible with a dot-separated path, say\n`site.dir.page`.  On the user side, you want that accessible as `/dir/page/`.  Except that if you are storing large fancy objects in the database, maybe you want to have those accessible with some extra bits and bobs on the URL.\n\nErgo, you can have a SitePath that looks like this: `/dir/page/history.html` and it will still get the resource available at `site.dir.page` but you can see that there's a `history.html` page.\n\nFinally, if you want to get really complicated and do things like paginated URLs, you can split things with a `/$/` to send a pagination offset.  Something like `/dir/page/$/offset/16`, perhaps.\n\nHere's an example of a Express middleware that translates the URL to a path, where the root is `wh`:\n\n```\nfunction pathMap() {\n  return function doPathMap(req, res, next) {\n    req.sitepath = new Sitepath();\n    req.sitepath.fromUrlSegment(req.path, ['wh']);\n    next();\n  };\n}\n```\n\nFor further documentation, see [docs](docs.md)\n\n## Contributing\n\nIf you've found a bug:\n * Submit away!\n\nIf you'd like to submit a PR:\n * I do not expect you to smash multiple commits into a single commit.\n * Unless you say otherwise, I'm assuming \"maintainer-fixes\" style of merging, where I fix any quibbles and potentially make minor tweaks.  If you specify \"maintainer-reviews\", I'll maintain a list of things that I've identified for you to change.\n * If you've got a major patch in mind that's larger than an easily-mergable patch, you might consider writing up a blueprint describing what you want to do.\n\nPlease note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms -- see [code of conduct](CODE_OF_CONDUCT.md)\n\n## License?\n\nBSD, see LICENSE.txt","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frm3web%2Fsitepath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frm3web%2Fsitepath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frm3web%2Fsitepath/lists"}