NodeJS server for Sharepoint download/upload.
This acts as a proxy between your API and Sharepoint, allowing you to download/upload files from Sharepoint without exposing your Sharepoint credentials to your API.
Tested in a production environment.
- Download files from Sharepoint
- Upload files to Sharepoint
To download a file from Sharepoint, send a GET request to /download
with the following query parameters:
file
- The file path in Sharepointfolder
- The folder path in Sharepoint
To upload a file to Sharepoint, send a POST request to /ask-to-upload
with the following form data:
file_name
- The file name, this will be passed to your defined API in order to get the file (e.g.yourapi.com/query={file_name}
)file_title
- The file title, this will be the title of the file in Sharepoint
To start the server run npm run start
.
This will start the server on port 5000.
A docker image is available with Github packages and autogenerated on push to main.
You can pull the image with docker pull ghcr.io/drass/node-sharepoint-file-sharing:main
.
Alternatively, you can use docker-compose to start the server.
Remember to set the environment variables in the docker-compose file, in the .env
file or in the docker run --env
command.
The server can be configured with environment variables:
ORIGIN_DOMAIN
- Your APIs origin domain for CORSORIGIN_API
- You API path for the file upload withouth the domain (e.g./api/v1/file
). The file name will be appended to this path to get the file (e.g.yourapi.com/query={file_name}
)SHAREPOINT_URL
- Your Sharepoint URL, where the files will be uploaded toSHAREPOINT_USER
- Your Sharepoint usernameSHAREPOINT_PASSWORD
- Your Sharepoint password
The MIT license. Please see the LICENSE
file for more details.