koltyakov / sp-rest-proxy

🌐 SharePoint API Proxy for local development
MIT License
172 stars 43 forks source link

Register on NPM #3

Closed scatcher closed 8 years ago

scatcher commented 8 years ago

First off...VERY cool tool! I have hacked together pieces of this functionality for project specific development several times over the years but this makes it a heck of a lot easier.

Now for the question...would you mind registering this on NPM so I could pull it in as a dev-dependency. I have a few angular-cli projects in development and it would be ideal to spin up the api-proxy at the same time I serve my local client-side assets.

Thanks, --Scott

koltyakov commented 8 years ago

Thank you, Scott! I'm so glad that there are folks who found sp-rest-proxy useful. This project was created as a concept for one specific task in the development workflow to allow some local debugging and reduce deployment curves. There are some things missed in the current version, especially what is related to POST calls, which can be sensitive to the headers a call. Which can bring to different behavior in SP and proxy environment. Just to keep it in mind.

I could definitely publish it in NPM. Yet, got to think what kind of changes I need to apply before. It should have a module export object with some settings, which should be available to require in a local "server.js" (not to run it from node_modules/and_so_on..), it also could be a yeoman generator to include sp-rest-proxy, but I see it less convenient in keeping up to date.

If I published it as is it will be an equivalent as if you were included it in package.json like:

  "devDependencies": {
    "sp-rest-proxy": "git+https://github.com/koltyakov/sp-rest-proxy"
  }

After npm install sp-rest-proxy and all it' dependencies will be downloaded to node_modules, but it will not help much until there will be some real module functionality wrapper, which I plan to add this weekend.

koltyakov commented 8 years ago

I've published the module to NPM (https://nodei.co/npm/sp-rest-proxy/). There are some changes connected with this. Now it's more like a module and can be used in a project in the following way:

var RestProxy = require("sp-rest-proxy");

var settings = {
    configPath: __dirname + "/config/_private.conf.json", // Location for SharePoint instance mapping and credentials
    port: 8080,                                           // Local server port
    staticRoot: __dirname + "/static"                     // Root folder for static content
};

var restProxy = new RestProxy(settings);
restProxy.serve();

Please check for details in readme.md

scatcher commented 8 years ago

Awesome, I really appreciate it! I just added the new version to one of my projects and everything appears to work as expected.

Thanks, --Scott