- You need Node.js installed on you computer. Read more about installation Node.js.
When Node.js is on your computer you can start building package.
Now you need to install all dependencies.
And the final step – building the package:
You may get an error like:
We will use this file in our application.
If you enter the client ID and API key and start the file in your browser, you will see the following in the console:
Now let’s start creating the application.
- Create an app.htmlfile:
- Create app.jsin the same directory:
- Enter credentials, start in the browser and you will see in console:
This is what we’ve done here:
- var getStructure – the method with the API call.
- api.ListEntities – returns a list of files and folders from a defined path. Requires two parameters: clientId and path.
- path = path || ""; – use an empty string to get the root folder.
- var init – here we can define everything we want to do when the app. starts.
- init(); – start app.
- Now lets add a method which will display the list of folders and files received from GroupDocs API as DOM elements.
- We will also need somewhere to display this list so add this to the app.htmlfile’s body:
- As we need the same for the sub-folders, add this to var show_list:
- Also, we need to update parameters:
- Update the initfunction:
- Start the app only after the DOM is ready:
- The last thing we need to do is binding actions on folders – to open them and files – just to log in the console file’s GUID. To the end of show_listfunction, add:
And here is the bind events function:
You can add CSS and images to your own taste.
The final app may look like this