Marc Fearby
Marc Fearby

Reputation: 1384

Can I use IIS as the development server with "npm start"

I have created a React app and can "npm start" to use its built-in development server on port 3000 successfully, but I'd like to be able to run and debug my app in the context of my local IIS web server (so that I can refer to other services on that site using my current integrated authentication credentials).

Is there a way to tell "npm start" to not use its own built-in dev server and to use IIS instead (with the hot reloading whenever I change something in React)?

I can run it in IIS fine, so long as I "npm run-script build" first, then reload my browser, but that's just a wee bit undesirable during development.

Thanks.

PS, I used this to create the app: "npx create-react-app my-app --typescript"

Upvotes: 2

Views: 2436

Answers (2)

Marc Fearby
Marc Fearby

Reputation: 1384

Here's a full description of how I changed my web service in IIS to enable CORS and identity impersonation, so that my localhost:3000 React app could use it without fuss:

http://marcfearby.com/blog/computing/developing-in-react-with-an-api-hosted-in-iis

Upvotes: 1

Anil Kumar
Anil Kumar

Reputation: 2309

Any server will work which can serve static js files. Make sure you do required configuration to load index.html on every request.

As react app will be bootstrapped using index.html, so this should be the file which will be loaded all the time.

Upvotes: 0

Related Questions