Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Node.jsとExpressをいじりまわします。私は今、次のものを持っています:
app.get('*', function(req, res) { });
すべてのURLをキャッチする必要があります。静的ファイルを除外する最良の方法は何ですか?.css、.js、.pngで終わる(または「css /」、「js /」、「img /」で始まる)?
静的ファイルをに入れないでください./views。それらを入れて、./public上にこの行を追加しますapp.use(app.router):
./views
./public
app.use(app.router)
app.use(express.static(path.join(__dirname, 'public')));
必要なのはそれだけです。他に何も必要ありません。