Unable to initialize the ng2-admin Angular2 Bootstrap template on a Go server due to a failed download attempt

Hello everyone, I am a newcomer to this forum and have limited experience with Angular2 and Golang. I am currently facing an issue as I want to experiment with a template on a Go server.

To tackle this, I created a main.go file that includes the following main() function:

func main() {
    r := mux.NewRouter()
    p := http.StripPrefix("/", http.FileServer(http.Dir("./src/")))
    n := http.StripPrefix("/config", http.FileServer(http.Dir("./config/")))
    r.PathPrefix("/config/").Handler(n)
    r.PathPrefix("/").Handler(p)
    fmt.Printf("Starting server on :33166 \n")
    http.ListenAndServe(":33166", r)
}

After running go run main.go in the project directory, I encountered a failure with this request:

GET http://127.0.0.1:33166/webpack-dev-server.js

Although the solution may be straightforward, I seem unable to resolve it on my own. Any suggestions on how to successfully run the project on the server would be greatly appreciated. Thank you.

Answer №1

When setting up ng2-admin with a different backend system such as golang, the installation guidelines recommend creating a release build by running the command specified below:

npm run prebuild:prod && npm run build:prod

The installation guidelines further explain:

This process will remove any existing files in the dist folder (where release files are stored) and generate a release build (...). Once completed, you can transfer the sources from the dist folder to integrate it with a backend framework or host it on a web server.

UPDATE: Special thanks to @PatrickWalker for his valuable input.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Steps for displaying a new event on a fullCalendar

Utilizing fullCalendar to display a list of events in the following manner: this.appointments = [{ title: "Appointment 1", date: "2020-09-06", allDay: false }, { title: "Appointment 2", date: "2020 ...

Tips for updating the main route and its components upon re-clicking in Angular

Within my application, I have a Master-Detail setup consisting of a main container component holding two nested components - master and detail. By clicking on the link http://localhost:4200/master, the master component fetches data from the server to displ ...

Unable to install Typescript using npm

I recently started a tutorial on Typescript and wanted to install it globally using npm. npm i typescript -g However, I encountered an issue where the installation gets stuck on the first line and displays the following message: (⠂⠂⠂⠂⠂⠂⠂⠂ ...

Exploring Angular 7: Leveraging class inheritance and the powerful httpClient

It has come to my attention that my services are quite repetitive. In an attempt to enhance them, I decided to delve into super classes and inheritance in Angular. However, I have been struggling with the constructor and super calls. Despite TypeScript com ...

Encountering trouble installing Angular CLI on MacOS High Sierra version 10.13.2

I am encountering an issue while trying to install Angular CLI. I have successfully installed the latest NodeJs version 8.9.4 and npm version 5.6.0. However, when I attempt to run the command npm install -g @angular/cli, I receive the following error messa ...

BehaviorSubject does not retain duplicate entries in the array

When adding values to a service and component, the first value in the array changes to the second value. Here is an overview of the code: Service export class PrepayService { private _carts: BehaviorSubject<ShoppingCart[]>; carts : Observable ...

Communication between a local server and the browser rendering in Angular

It seems like I may be approaching this task in the wrong way. Currently, I have a Nodejs server running that reads data from a DB and serves it locally through express using http. The server sends the data on localhost at a specific port (for example, 80 ...

Top tips for effectively crafting and interpreting an app configuration file in an Angular application

My Angular application needs to be installed on multiple sites, with each site requiring different configurations such as colors, texts, logos, and backend servers. I would like to create a configuration file that can be easily modified and read by the Ang ...

angular-oauth2-oidc - Issue with missing 'State' and 'Scope' parameters

One crucial requirement set by the identity server is to refrain from including 'state' and 'scope' in the URL. The specified request format is as follows URL?app=xxx&response_type=code&client_id=yyy&state=zzz&redirect_ ...

What is the proper way to display the date and time 2021-11-14T18:30:00.000+00:00?

Here is my ts file code: mydate: Date = new Date('2021-11-14T18:30:00.000+00:00'); However, I want the date to be in this format:- 07-July-2022 If anyone can assist with achieving this format, it would be greatly appreciated. Thank you! ...

Tips for defining a distinct series of key-value pairs in typescript

Having experience with a different language where this was simple, I am finding it challenging to articulate a sequence of pairs: Each pair is made up of two basic elements (such as strings or numbers) Each element may appear multiple times within the lis ...

Namespace remains ambiguous following compilation

I'm currently developing a game engine in TypeScript, but I encountered an issue when compiling it to JavaScript. Surprisingly, the compilation process itself did not throw any errors. The problem arises in my main entry file (main.ts) with these ini ...

The cache-control header is not being included in the response header in the express app

I am facing an issue where the Cache-Control header is not getting added to the document request in my express / node server. My code successfully adds other headers, but for some reason, it fails when trying to add Cache-Control and I'm unsure why. ...

Storing a byte array in a local file using JavaScript: A Step-by-Step Guide

Recently, I encountered an issue while working with an openssl certificate. Specifically, when I tried to download the certificate from my API, it returned byte arrays that I needed to convert to a PEM file in order to access them through another API. The ...

How can I arrange selected options at the top in MUI autocomplete?

I am currently working with mui's useAutocomplete hook https://mui.com/material-ui/react-autocomplete/#useautocomplete Is there a way to programmatically sort options and place the selected option at the top using JavaScript sorting, without resorti ...

Syntax for TypeScript generic promises definition

I'm struggling to fully grasp the definition of Promise in TypeScript, as shown below: /** * Represents the completion of an asynchronous operation */ interface Promise<T> { /** * Attaches callbacks for the resolution and/or rejectio ...

What is the best way to connect a text box to a nested object in the state of a React component?

Solving a React Debugging Dilemma In my current project, I'm developing an office add-in using a React-based starter kit and TypeScript. Unfortunately, debugging has been a challenge as I am unable to access detailed error messages from React in my s ...

Issue: In an Angular electron app, a ReferenceError is thrown indicating that 'cv' is

I have been working on a face detection app using OpenCv.js within an Angular electron application. To implement this, I decided to utilize the ng-open-cv module from npm modules. However, when attempting to inject the NgOpenCVService into the constructor ...

What are the best practices for preventing risky assignments between Ref<string> and Ref<string | undefined>?

Is there a way in Typescript to prevent assigning a Ref<string> to Ref<string | undefined> when using Vue's ref function to create typed Ref objects? Example When trying to assign undefined to a Ref<string>, an error is expected: co ...

Navigating to the standalone URL for Angular 16 will consistently redirect users to the homepage

I am facing an issue with my Angular 16 app. It is a pure standalone application, without any ng modules. I have configured routes, and when using links within components (e.g.: routerLink="/team"), it successfully routes to the correct page and updates th ...