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
Login as a Admin
Go to admin pannel
3. Click on PLUGINS and select write api in the drop down.
4. Enter Admin uid and click on create token
How to find admin uid
1.Go to admin pannel.
2.click on Manage and select users
3. You can see the list of users here
Store Sunbird identifier mapped with NodeBB category
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 } ] }
Issues:
1. SbCategory schema creation having issue in staging
2. Schema creation (sbCategory) for multiple hosts, ports(clustered db)