0

I have a an application that converted an IBM Notes db in to a angular app. I can access the Notes files trough the index.html by simply opening it in my browser. Once it works in my browser, I would like to host it in a server. I have created a server and I have exposed the index.html but all I see is a blank page. Below is the index file. I can inspect it and see the html. Maybe , when I run it in a server, it the index is not calling the js files? What should I do in order to serve the index and see everything just the way I see when I simply open it in my browser?

enter image description here

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Teamstudio Export</title>
  <!--<base href="/">-->

  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.css"></head>

<body>
  <app-root></app-root>
  <script src="runtime.js" defer></script>
  <script src="polyfills-es5.js" nomodule defer></script>
  <script src="polyfills.js" defer></script>
  <script src="main.js" defer></script>
 </body>
</html>

Alex DS
  • 81
  • 8

2 Answers2

0

One thing I notice is that you have commented out the <base href="/"> tag, you will more than likely need this. And often times I have personally had to make the tag look like this <base href="./"> which is simply just adding a period in front of the slash. This just tells the server where the file is that you would like to have shown to begin with.

Skelly
  • 46
  • 4
  • I was able to run it using the node http-server. So it run in my localhost. No need to uncomment the "". Now, how do I replicate it in my server. – Alex DS Aug 29 '22 at 12:36
  • A few of the angular apps I have built all from the start use that `` to handle their routing when deployed to a local server even. I am unsure how you are getting it to work without it unless you are doing a couple extra steps to set up the way your app is hosted on a server. Here is a link you could take a peek at and see if some of the information can help you. https://stackoverflow.com/questions/51182322/whats-the-difference-between-base-href-and-deploy-url-parameters-of-angular – Skelly Aug 29 '22 at 15:08
0

I have found the solution and it is very simple. I have just created a node server that serves the folder where all those files are. I have added all the files in the public folder and I serve it as static. I have deplyed it in my server and it is working like a charm Se code example below

const express = require('express')
const app =express()

app.use(express.static('public')) //all files inside the public folder

app.listen(5000,()=>{
    console.log('✅ Server running on  http://127.0.0.1:5000/')
})
Alex DS
  • 81
  • 8