1
的NodeJS工作
我在我的網站封鎖'api', 'components', 'app', 'bower_components', 'assets'
如下:爲什麼正則表達式是不是在
app.route('/:url(api|components|app|bower_components|assets)/*')
.get(errors[404]);
不幸的是,我能夠訪問時,我在我的網站鍵入「http://localhost/api」。請讓我知道上面的代碼中哪一個缺失或錯誤。謝謝。
':url'是做什麼用的? – hjpotter92
@ hjpotter92所提供的語法URL – ppshein
是正確的,你也可以嘗試添加一個斜線,例如'「/:URL \ /(API |成分|應用| bower_components |資產)/ *」'(請注意,反斜槓可能需要加倍)。 –