Serving static content alongisde Angular app

Serving static content alongisde Angular app

I want to server some static content on the root of my web server (landing page) alongside an angular app. I want to be able to serve the static content when the user accesses the '/' (root) of the page while service the app at '/portal'.

I want to server some static content on the root of my web server (landing page) alongside an angular app. I want to be able to serve the static content when the user accesses the '/' (root) of the page while service the app at '/portal'.

I've tried making the static content individual components, but since I'm working with a predefined template I cannot include them (I get parse errors at compile-time, because of duplicate <doctype>, etc etc).

Also, I'm serving the whole thing with express, so what I thought of was to make use of express' utilities

app.use('/',express.static(path.join(__dirname, 'dist/landing')));
app.use('/portal',express.static(path.join(__dirname, 'dist')));

so far I got the landing page working, and I'm able to access the prtal part but I see on the console that the resources (vendor.js, runtime.js etc) are not being loaded (404s).

Other combinations of app.use and app.get might get me to the point of accessing the portal and have it working but whenever I refresh the page inside it (I'm logged in) I get a blan page (404).

I have the <base> set to href='/' but changing it has only complicated things more.

I'm sorry to be asking this, but I'm a complete newbie on angular/express. Is there a way to get around this? I haven't been able to find an example that covers serving static files and an app using express

Would someone please guide me through this? I tried every combination of app.use and app.getand read lots of documentation without getting a clear understanding of how this would work.

Thanks in advance.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Angular 8 Node & Express JS File Upload

In this Angular 8 and Node.js tutorial, we are going to look at how to upload files on the Node server. To create Angular image upload component, we will be using Angular 8 front-end framework along with ng2-file-upload NPM package; It’s an easy to use Angular directives for uploading the files.

Создание сайта на Mongo DB, Express JS, Node JS и Angular

Видео курс по изучению стека MEAN. В курсе вы научитесь создавать сайты при помощи Node JS, Express JS, Angular JS и баз данных MongoDB. Вы ознакомитесь со всеми моментами разработки и в конце курса выгрузите сайт на удаленный сервер.

How to Use Express.js, Node.js and MongoDB.js

In this post, I will show you how to use Express.js, Node.js and MongoDB.js. We will be creating a very simple Node application, that will allow users to input data that they want to store in a MongoDB database. It will also show all items that have been entered into the database.