Javascript NodeJS/ExpressJS中基于文件的路由

Javascript NodeJS/ExpressJS中基于文件的路由,javascript,node.js,express,Javascript,Node.js,Express,在NodeJS(或ExpressJS)中有没有方法执行以下操作 虽然我理解路由提供的灵活性,但我非常不喜欢它的配置方式。(我不是快递专家) 例如,应用程序结构如下所示: app -- public // has all the static files. -- dynamic // Root level file for something that contains all the dynamic pages -- index.nsf // NSF == node server fil

在NodeJS(或ExpressJS)中有没有方法执行以下操作

虽然我理解路由提供的灵活性,但我非常不喜欢它的配置方式。(我不是快递专家)

例如,应用程序结构如下所示:

app
-- public // has all the static files.
-- dynamic // Root level file for something that contains all the dynamic pages 
   -- index.nsf // NSF == node server file (Just making up a sample extension here).
                // NSF files have front matter and code like shown in section below
   -- posts // A directory
      -- view.nsf
      -- edit.nsf
   -- pages
      -- thankyou.nsf
      -- contactus.nsf
i、 e当用户转到url“”时,将呈现该nsf文件中的内容

我心目中的国家科学基金会,可能看起来像下面的样子——只是一些YAML前沿问题

---
controller: contactUsController // A javascript file
layout: contact // Jade layout or HTML layouts
---
或者以一些YAML的前端内容和布局作为文件的内容

---
controller: contactUsController
---
extends base
h1 This is the contact us page. Fill in the details below.
即使是设置如下中间件的一次性配置也可以工作:

app.use(app.**some_automatic_router**);
app.use(express.static(path.join(__dirname, 'public')));

谢谢。

也许您正在寻找这样的产品: