Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

193
Visualizações
How to include JavaScript sources in startup.cs of AspNetCore?

Is there an easy way to reference JS sources from a JS project that has "JSProj/src/main.js" , "JSProj/package.json" to run at "AspNetCoreProj/startup.cs"?

So that when the asp is run, my controller from "AspNetCoreProj/Controllers/MyController.cs" binds to (launchSettings.json) "applicationUrl": "http://localhost:44709", "sslPort": 46367 AND the front-end JS App is run at, let's say, http://localhost:8080 at the same time?

So that I only need to run the asp app, not the two applications, including AspNetCoreProj and JSProj, separately.

I already installed node.js and run the JS app server using npm run build / npm run serve / yarn serve from command line, but I do not understand the concept of deploying the JavaScript sources (especially when it uses some framework like Angular) along with my ASP project, it just doesn't compile and/or run (that is to say: I'm very new to JS and its frameworks concept).

Do I really need to run a separate JS server for front-end or I can easily reference a JS project in a let's say, index.html / index.cshtml page?

edit: I need to know how to bind an asp.net core project with an angular (react.js / vue.js) project.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

When a JS framework runs using serve, it will run on its own in-memory server like in angular a node.js server with its own port ,one option like you mentioned is to run manualy both server and js framework,another option in asp.core is to "tell" the server to run the JS framework ,in any of this options (while developing) the JS framework will run from its own local server (in angular a node.js) it is just that in second option the asp.core will do the serve for you,for this to happaned you need to "tell" the asp core application what to do on startup,in order to do that in you need to configure startup.cs ,i think the best way is to open a new angular project from template project in visual studio you can see all the settings that is needed, i will just mention ,that there are settings in 3 places : in startup.cs in ConfigureServices() and in Configure() as well as right click on the asp.core project=> editproject there are some commands how to handle the angular app when compiling as well some publish commands

about 4 years ago · Juan Pablo Isaza Relatório

0

In fact the problem was that an MVC (Web Controller app) project cannot be used to run JavaScript, It needs to be an "Angular" asp.net core web app or an asp.net core web app that's configured to use a single-page application (SPA) in startup.cs.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda