エントリーの編集
                エントリーの編集は全ユーザーに共通の機能です。
                    必ずガイドラインを一読の上ご利用ください。
同じexpressのプロセスでドメインごとに違うページを表示する - Qiita
記事へのコメント0件
- 注目コメント
 - 新着コメント
 
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
          - バナー広告なし
 - ミュート機能あり
 - ダークモード搭載
 
関連記事
同じexpressのプロセスでドメインごとに違うページを表示する - Qiita
const express = require("express"); const app = express(); // ドメインごとに読み込む const domain... const express = require("express"); const app = express(); // ドメインごとに読み込む const domain1 = require("./example1.js"); const domain2 = require("./example2.js"); app.use( (req, res, next) => { // アドレスのホスト名(ドメイン) var host = req.hostname; if( host == "example1.jp" ) { // routerに飛ばす domain1(req, res, next); } else if( host == "example2.jp") { // 別のrouterに飛ばす domain2(req, res, next); } else { // どれにも対応しない
              
            
