通过Cpanel在共享主机上上传Angular和Laravel

时间:2019-07-06 08:32:33

标签: angular laravel hosting cpanel

我已经使用Angular 8创建了一个单页应用程序,该应用程序使用了使用Laravel构建后端API。在我的本地计算机上,一切都运行良好。现在,我想通过CPanel将其上传到共享主机上。首先,我将后端Laravel项目上载到名为test-app的public_html文件夹中的子文件夹中。

这是因为我已将域设置配置为具有子域 指向该子文件夹。因此,基本上,当用户键入 test-app.example.com 时,它指向该子文件夹;如果用户键入 example.com ,则其指向我的主网站。

现在不确定在本地Angular项目上运行 ng-build 后将dist文件夹上传到哪里。我希望它消耗它所在的Laravel项目的API端点。

test-app子文件夹中的htaccess文件

var axios = require('axios')

  axios({
        method: 'POST',
        url: 'https://www.lowes.com/cart/promocode/472100200226378',
        data: {

        },
        headers: 
         { 'Postman-Token': 'b911a7ac-6a07-4ab6-864c-178b824a926e',
       'cache-control': 'no-cache',
       'Host' : 'www.lowes.com' } ,
        validateStatus: (status) => {
          return true; // I'm always returning true, you may want to do it depending on the status received
        },
      }).then(response => { 
    console.log(response)
  })
  .catch(error => {
      console.log(error.response)
  });

0 个答案:

没有答案
相关问题