Angular 6 localhost两个网址相同的端口

时间:2019-02-21 19:15:53

标签: angular

我使用Angular6。我想在本地主机中定义两个不同的url。

这些网址是:

http://${location.hostname}:3500/products

http://${location.hostname}:3500/shoppingchart

要定义这些网址,我有一个文件

restData.js

module.exports = function () {
    var data = {
        products: [
            { id: 1, name: "Kayak", category: "Watersports", price: 277, quantity: 5 },
            { id: 2, name: "Lifejacket", category: "Watersports", price: 48.95, quantity: 10 },
            { id: 3, name: "Soccer Ball", category: "Soccer", price: 19.50, quantity: 8 },
            { id: 4, name: "Corner Flags", category: "Soccer", price: 34.95, quantity: 6 },
            { id: 5, name: "Stadium", category: "Soccer", price: 79500, quantity: 6 },
            { id: 6, name: "Thinking Cap", category: "Chess", price: 16, quantity: 7 },
            { id: 7, name: "Unsteady Chair", category: "Chess", price: 29.95, quantity: 4 },
            { id: 8, name: "Human Chess Board", category: "Chess", price: 75, quantity: 8 },
            { id: 9, name: "Bling Bling King", category: "Chess", price: 1200, quantity: 6 }
        ]
    }
    return data
}
module.exports = function () {
    var data1 = {
        charts: [
            { id: 1, name: "Kayak", category: "Watersports", price: 277, quantity: 5 },
            { id: 2, name: "Lifejacket", category: "Watersports", price: 48.95, quantity: 10 },
            { id: 3, name: "Soccer Ball", category: "Soccer", price: 19.50, quantity: 8 },
            { id: 4, name: "Corner Flags", category: "Soccer", price: 34.95, quantity: 6 },
            { id: 5, name: "Stadium", category: "Soccer", price: 79500, quantity: 6 },
            { id: 6, name: "Thinking Cap", category: "Chess", price: 16, quantity: 7 },
            { id: 7, name: "Unsteady Chair", category: "Chess", price: 29.95, quantity: 4 },
            { id: 8, name: "Human Chess Board", category: "Chess", price: 75, quantity: 8 },
            { id: 9, name: "Bling Bling King", category: "Chess", price: 1200, quantity: 6 }
        ]
    }
    return data1
}

启动应用程序时,我会在控制台中看到

Loading restData.js
  Done

  Resources
  http://localhost:3500/charts

  Home
  http://localhost:3500

URL的值是最后一个。

如何在本地主机中定义两个URL?

0 个答案:

没有答案