在Remix中存放助手代码和类型的位置

huangapple go评论71阅读模式
英文:

Where to keep helpers code and types for Remix

问题

我是新手使用 Remix 并开始一些开发工作。由于app目录中的所有代码基本上都像路由一样运行,如果我在app目录中创建一个helpers文件夹,并在其中包含辅助函数(使用TypeScript,.ts文件),我不一定希望将该代码暴露为路由。

我还想为我的所有类型创建一个文件夹或文件。

那么我应该把它们放在哪里,以便它们不成为路由?

英文:

I'm new to Remix and beginning some development with it. Since all code in the app directory essentially behaves like a router, if I were to make a helpers folder in app along with helper functions inside (using TypeScript, .ts files), I wouldn't necessarily want that code exposed as a route.

I also want to have a folder or file for all my types.

So where do I put them, so they are not a route?

答案1

得分: 0

只意识到在 app 下有 routes 文件夹,因此我可以将我的辅助代码和类型放在 app 内,但不在路由之内,从而实现我想要的。

英文:

Duh! Just realized that under app is the routes folder, hence I can place my helpers code and types under app but outside of routes and therefore achieve what I wanted.

huangapple
  • 本文由 发表于 2023年6月29日 01:46:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76575583.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定