Git Product home page Git Product logo

umbraco.headless.client.nodejs's Introduction

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

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

umbraco.headless.client.nodejs's People

Contributors

askilada avatar dependabot[bot] avatar rasmusjp avatar sitereactor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.