Skip to content

Implements versioned Topics, hierarchical structures (parent-child topics), and a shortest path algorithm

Notifications You must be signed in to change notification settings

leaopedro/dynamic-knowledge-base

Repository files navigation

Dynamic Knowledge Base

This repository provides a Nodejs + Typescript project, with a simple in-memory db. It implements versioned Topics, hierarchical structures (parent-child topics), and a shortest path algorithm.


Installation & Setup

  1. Install dependencies: npm i

  2. Development mode: npm run dev server will be available at http://localhost:3000.

  3. Build: npm run build

  4. Start: npm run start Runs the compiled code from dist/server.js.

  5. Lint: npm run lint

  6. Format: npm run format Formats the codebase using prettier

Endpoints

  1. Create TopicPOST /topics (creates a new topic, version=1)
       {
          "name": "Topic Name",
          "content": "Description or content",
          "parentTopicId": "optional-parent-id"
       }
  2. Get All Latest TopicsGET /topics
  3. Get a TopicGET /topics/:topicId?version=X (optional specific version or latest)
  4. Update a TopicPUT /topics/:topicId (creates a new version)
  5. Delete a TopicDELETE /topics/:topicId (deletes all versions)
  6. Get Topic TreeGET /topics/:topicId/tree
  7. Shortest PathGET /topics/:startId/path/:endId

Testing

Unit Tests

  • Run via npm run test:unit

Integration Tests

  • Run vianpm run test:integration

All Tests

npm run test

TODO

  • CRUD for Resources;
  • CRUD for Users;
  • Add auth middleware to handle user permissions in all endpoints;

About

Implements versioned Topics, hierarchical structures (parent-child topics), and a shortest path algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published