Platform libraries

Contents

Introduction

When building Enonic apps you may access a broad set of platform capabilities by requiring these libraries. Each library is pulled into your app as a build.gradle dependency and loaded at runtime via require('/lib/xp/<library>').

A library can be loaded two ways — both fully typed once the @enonic-types packages are installed (see TypeScript):

require — CommonJS, the standard form
const authLib = require('/lib/xp/auth');
const user = authLib.getUser();
ES6 import — also needs a paths mapping in tsconfig.json
import { getUser } from '/lib/xp/auth';
const user = getUser();

Headless APIs

Visit the CMS documentation for details regarding the content schemas and our headless GraphQL API

JavaDoc

Java developers or anyone interested in a Platform deep dive may check out our JavaDoc (zipfile download).


Contents

Contents