Skip to content

Instantly share code, notes, and snippets.

@pcattori
Created May 7, 2024 17:31
Show Gist options
  • Save pcattori/96b925a9674ad4424343d620b8f8c4a2 to your computer and use it in GitHub Desktop.
Save pcattori/96b925a9674ad4424343d620b8f8c4a2 to your computer and use it in GitHub Desktop.

Our job as framework authors is to strike a balance b/w prescribing a solution and scaling a solution from small apps to large apps.

We should only strongly prescribe when:

  1. There's already a clear winner (TypeScript)
  2. when the whole team believes should be the one obvious way to do something
import { route } from "remix"

/*
/about -> routes/about.tsx
/products/:id
  -> layout: routes/products/layout.tsx
  -> route itself: routes/product.tsx
*/
export default [ // manually defining routes without any sort of convention
  route("about", "./routes/about.tsx"),
  route("products", "./routes/products_layout.tsx", [
    route(":id", "./routes/product.tsx")
  ])
]
// ^ array API

export default {
 "/about": "./routes/about",
 "/products": {
   index: "", 
   layout: "./routes/products_layout",
   "/:id": "./routes/product"
 }
}
// ^ object API


// third-party or in-house convention for routes
export default kilimansAwesomeNewFilesystemRoutes("./app/routes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment