Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this react app be deployed as a web app on to a windows server so that users can access the app outside of the server ? #139

Open
noah09dvlpr opened this issue Feb 4, 2022 · 6 comments
Labels

Comments

@noah09dvlpr
Copy link

No description provided.

@noah09dvlpr
Copy link
Author

I am trying to build a react app outside of SharePoint but the app should fetch the SharePoint Search API. I could not find a way to establish the connection from react app to SharePoint except yours. I have two questions:

  1. Can I deploy your cloned app as a web app onto IIS so that it can be used by other users ?
  2. How can I enable this app that it can take user ID and PWD everytime the app is tried to access by users ?

@koltyakov
Copy link
Owner

Hi @noah09dvlpr,

  1. No, sp-rest-proxy is a toolchain for development time. One should use anonymously exposed APIs for nothing but a local dev boosting. You need to deploy your React App to SharePoint page.

  2. It's not possible and never should be done this way. A React App should be hosted either at SharePoint page with SharePoint client & auth contexts or the app should auth SharePoint via OAuth2/OIDC from is a tenant allows. Yet another alternative is Provider Hosted apps, but I personally can't recommend this approach as too complex and legacy one.

@noah09dvlpr
Copy link
Author

Thank you so much for quick response. This is a development project we are working on so we feel that it is okay to move forward with your app.
Can you please confirm me that if I deploy this app onto a IIS server, will it work as a web app which can do the same job as it does on local machine ?

@koltyakov
Copy link
Owner

Generally, Node.js servers are not deployed to IIS. IIS doesn't support Node.js OOTB, there are some experimental extensions but IIS is not the way running Node anyways. You can proxy with ARR in IIS or use another reverse proxy which is more natural for modern era.

For dev scenarios, you always run sp-rest-proxy only locally next to Local Dev Server or inside it https://github.com/koltyakov/sp-rest-proxy#webpack-dev-server

@noah09dvlpr
Copy link
Author

I face the below error when I try to build the app. Tried every other solution available online but does not help. Thanks in advance.
image

And the dist folder fails to have the html and js files required for the app to host on IIS. IIS is all configured to run the app but the files are not generated.
image

@koltyakov
Copy link
Owner

I face the below error when I try to build the app.

Not an error, warning. One of the linter plugins has a restriction for TypeScript version.

You don't need building sp-rest-proxy from sources. It's an installable library.

And the dist folder fails to have the html and js

And it should not contain any html.

required for the app to host on IIS

A Node.js can't be hosted with IIS. It's server side JavaScript, IIS can't run Node.js, it can proxy to a server with ARR. There are such experiments like iisnode but they don't have a lot sense.

I'd recommend not to waste time with IIS. Industry standards are a normal reverse proxy, e.g. Nginx/HAProxy/Traefik/etc., to and Node.js process(es).

And once again, hosting sp-rest-proxy for all devs and meaningless and not a good idea. It should be just integrated to your local dev server pipeline and act as a dev dependency within SPA. Please check this article describing the process in details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants