In this article you will be able to read about our Node.js Client library. You will be able to see a code sample showing you how to create a client and fetch some data from an Umbraco Heartcore project.
If you are unfamiliar with Node.js you can read more in the official Node.js documentation.
You will have to have Node.js version 10 or above to be able to work with this client library.
You can find the Client library on Github: Umbraco Heartcore Node.js.
You can either clone or download the Client library from Github or you can install it with npm.
Once you have installed the client library you can create a Client and start fetching data from a project. In the following sample we are fetching content from the root of a project and a media item targeted by its Id, and then logging the results in the console.
The Node.js library consists of a long list of different methods you can use in order to fetch and manage data from your Umbraco Heartcore project.
The methods to use when fetching content or media from the Content Delivery API uses the following convention:
In the examples above all content / media from the root
is called. You can also call specific content items by ID or URL, and you can even get related content items by calling e.g. children()
or ancestors()
. Find a full list of the available methods for the Content Delivery API on the sample repository on Github.
When using the Content Management API to manage content, media and the various types in your Umbraco Heartcore project, you need to use the following convention:
In the examples above, the first methods shows how the Content Management API is called in order to create new content and the second methods gives an example of how to get a list of all available content types. Find a full list of the available methods for the Content Management API on the sample repository on Github.