Socket
Socket
Sign inDemoInstall

@umbraco/headless-client

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@umbraco/headless-client

Node.js client library for the Umbraco Headless APIs


Version published
Weekly downloads
1.4K
decreased by-1.53%
Maintainers
4
Weekly downloads
 
Created
Source

Umbraco Heartcore Logo


NodeJS Client Library for Umbraco Heartcore

Umbraco Heartcore is the headless CMS version of Umbraco as a Service.

This repository contains the Node.JS client library for the Umbraco Heartcore REST APIs.

Prerequisites

  • NodeJS 10 or newer

Install

> npm install @umbraco/headless-client

Usage

Create a client, then call commands on it


// client.ts
import {Client} from '@umbraco/headless-client'

const client = new Client({
  projectAlias: 'your-project-alias',
  apiKey: 'your-api-key'
})

export default client

// rootLinks.ts
async function rootLinks(client: Client) {
  const rootContent = await client.delivery.content.root()

  const childPages = rootContent.map(child => ({
    url: child._url,
    name: child.name
  }))

  return childPages
}

function linkGenerator(links: {url: string, name: string}[]) {
  return links.map(link => {
    return `<a href="${link.url}">${link.name}</a>`
  })
}

async function main() {
  const rootLinks = await rootLinks(require('./client').default)
  const links = linkGenerator(rootLinks)
  console.log(links)
}

Documentation

General documentation for Umbraco Heartcore can be found on our.umbraco.com.

API documentation for the Client library can be generated by running the following

> npm install # install dependencies
> npm run build # build the sourch
> npm run docs # generate the documentation

This will generate markdown files in docs/api that can be openend in any markdown viewer.

A simple way to view them is to use markserv by running

> npx markserv docs/api

Keywords

FAQs

Package last updated on 22 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc