1 | const { SquidexClientManager } = require('squidex-client-manager');
|
2 | require('dotenv').config();
|
3 |
|
4 | const main = async () => {
|
5 | const clientSecret = process.env.SQUIDEX_CLIENT_SECRET;
|
6 | const clientId = process.env.SQUIDEX_CLIENT_ID;
|
7 | const url = process.env.SQUIDEX_CONNECT_URL;
|
8 | const appName = process.env.APP_NAME;
|
9 |
|
10 | const client = new SquidexClientManager(url, appName, clientId, clientSecret);
|
11 | const title = 'My post';
|
12 | const body = `
|
13 | ## topic 1
|
14 |
|
15 | Lorem ipsum dolor sit amet, quo ne malis saperet fierent, has ut vivendo
|
16 | imperdiet disputando, no cum oratio abhorreant. Agam accusata prodesset cu
|
17 | pri, qui iudico constituto constituam an. Ne mel liber libris expetendis, per
|
18 | eu imperdiet dignissim. Pro ridens fabulas evertitur ut.
|
19 | `;
|
20 | const expected = { data: { title: { iv: title }, text: { iv: body } }, publish: true };
|
21 | const article = await client.CreateAsync('Articles', expected);
|
22 | console.log(JSON.stringify(article, null, 2));
|
23 | };
|
24 |
|
25 | main();
|