Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Nodebb Setup

To setup nodebb we have to fallow the below steps

go to nodebb folder and the execute the commands

./nodebb setup
./nodebb start

Install nodebb plugins

To install required nodebb plugins using npm

we are using below plugin

npm install https://github.com/Sunbird-Ed/nodebb-plugin-sunbird-oidc.git
npm install https://github.com/Sunbird-Ed/nodebb-plugin-sunbird-api.git
npm install https://github.com/Sunbird-Ed/nodebb-plugin-sunbird-telemetry.git
npm install https://github.com/Sunbird-Ed/nodebb-plugin-azure-storage.git
npm install https://github.com/NodeBB/nodebb-plugin-write-api.g

Activate Plugins

After installing the plugins, we can able to see those plugins in nodebb application but all are in inactive state. To activate the plugins we can use the below command.

command:
nodebb activate nodebb-plugin-plugin-name

Example: 
nodebb activate nodebb-plugin-write-api

Creating Nodebb Token

We need master token for creating user and user token in the plugins. without master we can’t generate the user token and all nodebb apis need user token to perform nodebb operations.

  1. Login as a Admin

  2. Go to admin pannel

3. Click on PLUGINS and select write api in the drop down.

4. Click on Create Token in Master token section

Store Sunbird identifier mapped with NodeBB category

Sunbird content(identifier) mapping to NodeBB Category. This is the new collection added to the Mongo DB to store the sunbird identifier mapping with the nodebb category.

SbType

SbIdentifier

cid

Data

Course

do_11317805943810457614592

5

{JSON}

Batch

01316730820300800028

6

{JSON}

Batch

01326730820300800256

7

{JSON}

Post: {host}/discussion/forum/v2/create

cUrl:

curl --location --request POST 'https://staging.sunbirded.org/discussions/api/forum/v2/create' \
--header 'Content-Type: application/json' \
--header 'Cookie: express.sid=s%3Aoc2sRQiZbgFE-oQRgfcQq3xZoFZWqxGS.J%2BsjxRf3Y3i8%2FJvLjdsxTNjMAmEebSEvmDCJV34aOp4' \
--data-raw '{
    "request": {
        "sbType": "course",
        "sbIdentifier": "do_21307805474221260815237",
        "cid": 6
    }
}'

Request:

{
    "request": {
        "sbType": "course",
        "sbIdentifier": "do_21307805474221260815237",
        "cid": 6
    }
}

Response:

{
    "id": "api.discussions.category.forum",
    "ver": "1.0",
    "ets": 1610038157022,
    "params": {
        "resmsgid": "ae9dec88-bf9d-4907-bed0-5ef8b86d6cae",
        "msgid": "",
        "status": "successful"
    },
    "responseCode": "OK",
    "result": {
        "_id": "5ff73b8d1e9b1c00956d377b",
        "sbType": "course",
        "sbIdentifier": "do_21307805474221260815237",
        "cid": 6,
        "__v": 0
    }
}

Get Category mapped to Sunbird Identifier

API to get the NodeBB category(or categories) mapped to the sunbird content or Group etc.

Post: {host}/discussion/forum/v2/read

Curl:

curl --location --request POST 'https://staging.sunbirded.org/discussions/api/forum/v2/read' \
--header 'Content-Type: application/json' \
--header 'Cookie: express.sid=s%3Aoc2sRQiZbgFE-oQRgfcQq3xZoFZWqxGS.J%2BsjxRf3Y3i8%2FJvLjdsxTNjMAmEebSEvmDCJV34aOp4' \
--data-raw '{
    "request": {
        "type": "course",
        "identifier": "do_21307805474221260815237"
    }
}'

Request:

{
    "request": {
        "type": "course",
        "identifier": ["do_21307805474221260815237"]
    }
}

Response:

{
    "id": "api.discussions.category.forum",
    "ver": "1.0",
    "ets": 1610038493573,
    "params": {
        "resmsgid": "b03d8c99-2abc-4d6f-bbfc-c8067a10b74d",
        "msgid": "",
        "status": "successful"
    },
    "responseCode": "OK",
    "result": [
        {
            "_id": "5ff73b8d1e9b1c00956d377b",
            "sbType": "course",
            "sbIdentifier": "do_21307805474221260815237",
            "cid": 6,
            "__v": 0
        }
    ]
}


Edit User Post:

As a user we can edit our post and for

Issues:


1. SbCategory schema creation having issue in staging

2. Schema creation (sbCategory) for multiple hosts, ports(clustered db)

  • No labels