π External Learning Material JavaScript SDK
External Learning Material SDKβ
This document provides guidelines for developing external learning materials for Elice.
For other inquiries, please contact Elice.
SDK Installation and Initializationβ
Please install the External Learning Material JavaScript SDK as an npm package. This package can be used in a web environment.
# npm
npm install @eliceio/content-sdk --save
# yarn
yarn add @eliceio/content-sdk
Classβ
You can use the EliceContents
class provided by the installed SDK to access the methods and properties necessary for developing external learning resources.
import { EliceContents } from '@eliceio/content-sdk';
const eliceContents = new EliceContents({
baseUrl: 'https://api-external-contents.elice.io',
});
The options provided for initialization are as follows:
Name | Type | Description |
---|---|---|
baseUrl | string | The base URL for the Elice platform API server. The CORS policy only allows requests from the elice.io origin. Therefore, if you are testing in a local environment, you need to configure a proxy server or disable the CORS feature in your browser. |
To resolve CORS errors, please check the following:
- Install the CORS plugin
If a CORS error still occurs after installing the plugin, you can disable the browser's CORS feature using the command below in your terminal.
# Windows
chrome.exe --user-data-dir="C://chrome-dev-disabled-security" --disable-web-security --disable-site-isolation-trials
# macOS
open /Applications/Google\ Chrome.app --args --user-data-dir="/var/tmp/chrome-dev-disabled-security" --disable-web-security --disable-site-isolation-trials
# Linux
google-chrome --user-data-dir="~/chrome-dev-disabled-security" --disable-web-security --disable-site-isolation-trials