Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!