Code Monkey home page Code Monkey logo

Comments (7)

brucelane avatar brucelane commented on May 27, 2024 1

Thank you very much, very helpful!
Have a nice day Andrew!

from sp-rest-proxy.

koltyakov avatar koltyakov commented on May 27, 2024 1

Cheers! Any questions about sp-request and node-sp-auth are welcomed.

from sp-rest-proxy.

koltyakov avatar koltyakov commented on May 27, 2024

Hi Bruce,

Could you please elaborate your use case scenario?

We usually run a proxy in serve mode along or independently from the project, point the requests to the proxy's URL during the development cycle. This lets boosting with processes of SPA development without publishing anything to SharePoint or referencing to localhost'ed assets.

In such scenario, any http library (Axios, Fetch, jQuery.ajax, xhr, $http, etc.) can consume the service (with cross-domain origin requests nuances in mind). And one could not think about SharePoint auth related staff, just business logic.

After the development cycle, the code is published for hosting and living inside SharePoint pages context. The requests are routed to _spPageContextInfo.

Also, sp-rest-proxy can be integrated to the end project with settings pointing to your front-end files (settings.staticRoot).

--
Andrew

from sp-rest-proxy.

brucelane avatar brucelane commented on May 27, 2024

My first use case is to get data from a Sharepoint list into a nodejs microservices server to be used in a REST client (reactjs).

Later on, I would add CRUD operations.

from sp-rest-proxy.

koltyakov avatar koltyakov commented on May 27, 2024

So your project is a microservice API and it attends to run in NodeJS environment in production? Not only while the development stage?

If so, there is a nice way to deal with such case with the use of sp-request, which, btw, is also used in sp-rest-proxy.

Where is your React client-app living? Outside SharePoint?
Is the microservice in charge of users authentication too?

from sp-rest-proxy.

brucelane avatar brucelane commented on May 27, 2024

yes, development and production.
I will have a look at sp-request, for what I read it seems to handle authentication and modern javascript too!
The ReactJs / React-Native apps will be used outside Sharepoint, I create those microservices to create a json cache for SP lists because I will do server-side rendering and/or store the json files in the apps.
It's to store towns' road names, which don't get updated that often...

For the Update part, which is later, I would need to authenticate the users... but I'm not there yet

from sp-rest-proxy.

koltyakov avatar koltyakov commented on May 27, 2024

Got it!

Yep, I would recommend using sp-request and wrapping requests to SharePoint in your NodeJS API.
This allows you to separate API access to the specific operations.
sp-rest-proxy abstracts access layer to SharePoint. And any request to SharePoint tenant executes under provided service account. It's wonderful when the proxy extends development toolchain, but a not what is expected from a secure microservice in production. The idea behind the proxy is for slightly different things (dev toolchain, CI).

from sp-rest-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.