API documentation, or lack of?

NodeBB Development

Suggested Topics


  • 0 Votes
    3 Posts
    300 Views

    Also https://docs.nodebb.org/, I added a link to it in the nav bar as well

  • 0 Votes
    7 Posts
    364 Views

    ive found this post, but i dont understand how to get a csrf token
    https://community.nodebb.org/topic/6932/how-to-get-a-csrftoken-from-an-api-req-object/4

  • 0 Votes
    3 Posts
    309 Views

    I found a good way to get the user list out of mongodb. In case anyone need it:

    async function doMongoDb() { const { MongoClient } = require("mongodb"); const username = encodeURIComponent("admin"); const password = encodeURIComponent("mypassword"); const clusterUrl = "localhost:27017"; const authMechanism = "DEFAULT"; const uri = `mongodb://${username}:${password}@${clusterUrl}/?authMechanism=${authMechanism}`; const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true }); try { await client.connect(); const database = client.db("nodebb"); const objects = database.collection("objects"); // get all user const query = { _key: /^user:\d+$/ }; // select fields we want to see const options = { projection: { _id: 0, username: true, _id: false, email: true, "email:confirmed": true, joindate: true, fullname: true }, }; const cursor = objects.find(query, options); if ((await cursor.count()) === 0) { console.log("No user found!"); } // iterate over the users await cursor.forEach(user => { if (user["email:confirmed"] == 1 ) { console.dir(user); } }); } finally { // make sure we close the connection await client.close(); } } // --------------------------------------------------- function init() { try { doMongoDb(); } catch(e) { console.log(e); } } // --------------------------------------------------- init();
  • 0 Votes
    3 Posts
    404 Views

    @julian Thank you for the quick response!

  • 0 Votes
    1 Posts
    933 Views

    I have the write api plugin installed as well as the question and answer plugin. We are successfully creating topics and posts. Is it possible to create a topic as a question? I tried adding isQuestion (equals 1) to the POST body when creating the topic but it was ignored. Would the write-api have to be forked and updated to support the optional value of isQuestion? It seems clear in the question and answer plugin that it doesn't create/expose any write api of its own.