機能を変更できるサイドバーのあるページがあります。それぞれの異なるサイドバー レイアウトは div です。サイドバーの 2 つはテキスト入力を可能にします。現在、すべてのサイドバー レイアウトを処理するハンドラーを呼び出す app.get ステートメントが 1 つありますが、このソリューションは非常に面倒です。さまざまなサイドバーを分割して、さまざまなハンドラー関数を操作するにはどうすればよいですか?
たとえば、app.js に次のステートメントがあります。
app.post('/', home.sidebarHandler);
sidebarHandler は現在、ログインと新規ユーザーとしての登録の両方を処理していますが、これを 2 つの別個の関数で実行したいと考えています。
これが私の翡翠コードの一部です。これはdivの1つです:
form#sbCreateBox(method='post')
input.sbText(type='text', name= 'usernameReg', placeholder='Username', required)
input.sbText(type='text', name= 'acctHolderName', placeholder='Name')
input.sbText(type='email', name= 'useremail', placeholder='Email Address', required)
input.sbText(type='password', name= 'passwordReg', autocomplete='off', placeholder='Password', required)
input.sbText(type='password', name= 'passConfirm', autocomplete='off', placeholder='Confirm Password', required)
input#sbCreateButton(type='submit', value='Create Account')
個別の app.post ステートメントを持つようにルートを設定するにはどうすればよいですか?