{"id":15175394,"url":"https://github.com/mrsteele/next-routing","last_synced_at":"2025-10-01T12:31:23.933Z","repository":{"id":57310612,"uuid":"130936064","full_name":"mrsteele/next-routing","owner":"mrsteele","description":"A nuxt inspired routing plugin for nextjs","archived":true,"fork":false,"pushed_at":"2020-08-26T01:27:56.000Z","size":218,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-30T14:04:13.569Z","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/mrsteele.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":"2018-04-25T01:55:26.000Z","updated_at":"2023-01-28T13:07:27.000Z","dependencies_parsed_at":"2022-09-09T08:02:35.908Z","dependency_job_id":null,"html_url":"https://github.com/mrsteele/next-routing","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/mrsteele%2Fnext-routing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fnext-routing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fnext-routing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsteele%2Fnext-routing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrsteele","download_url":"https://codeload.github.com/mrsteele/next-routing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219875435,"owners_count":16554678,"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-09-27T12:23:42.305Z","updated_at":"2025-10-01T12:31:18.636Z","avatar_url":"https://github.com/mrsteele.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# next-routing\nA nuxt inspired routing plugin for nextjs\n\n### About\n\nDEPRECATED: This is now a deprecated package since nextjs now supports this functionality natively.\n\nThis is a routing plugin for [next](https://github.com/zeit/next.js/) inspired by [nuxt routing](https://nuxtjs.org/guide/routing/). The idea is that your routing becomes a lot simpler by prepending underscores (`_`) on your routes to create path parameters automatically.\n\n### Installation\n\nYou can install this package by using npm like so:\n\n```\nnpm i next-routing --save\n```\n\n##### Page\n\nIf a file or folder begins with an underscore (`_`), it will define that route part as a path parameter.\n\nFor example, if you had a file `/pages/users/_id/comments.js`, it would convert that route to `/users/:id/comments`.\n\nThe same can be applied to files. If you had a file `/pages/users/_id.js`, the route would be `/users/:id`.\n\nThis could be accessed like below:\n\n```js\nexport default class User extends React.Component {\n  static async getInitialProps ({ query }) {\n    // query.id\n  }\n  render () {\n    // this.props.url.query.id\n  }\n}\n```\n\n##### Server\n\nYou will need to add a hook on your server to intercept requests:\n\n```js\n// server.js\nconst next = require('next')\nconst app = next({\n  dev: process.env.NODE_ENV !== 'production'\n})\n\n// make sure you export this as well as call this\nmodule.exports.routes = require('next-routing')()\nconst handler = module.exports.routes.getRequestHandler(app)\n\n// With express\nconst express = require('express')\napp.prepare().then(() =\u003e {\n  express().use(handler).listen(3000)\n})\n\n// Without express\nconst {createServer} = require('http')\napp.prepare().then(() =\u003e {\n  createServer(handler).listen(3000)\n})\n```\n\n##### Client\n\nYou will need to import the `Link` from your server file created above.\n\n```js\nconst { Link } = require('../server').routes\n```\n\n##### Configuration\n\nWhile not required, it is recommended that you [disable file-system routing](https://github.com/zeit/next.js#disabling-file-system-routing) for added security and intentionality of how your routes are accessed.\n\nFor a full list of the api, feel free to checkout [next-routes](https://github.com/fridays/next-routes#on-the-client) documentation (we piggy-back of what they have already done).\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsteele%2Fnext-routing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrsteele%2Fnext-routing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsteele%2Fnext-routing/lists"}