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.
-
Install dependencies:
npm i -
Development mode:
npm run devserver will be available at http://localhost:3000. -
Build:
npm run build -
Start:
npm run startRuns the compiled code fromdist/server.js. -
Lint:
npm run lint -
Format:
npm run formatFormats the codebase usingprettier
- Create Topic –
POST /topics(creates a new topic, version=1){ "name": "Topic Name", "content": "Description or content", "parentTopicId": "optional-parent-id" } - Get All Latest Topics –
GET /topics - Get a Topic –
GET /topics/:topicId?version=X(optional specific version or latest) - Update a Topic –
PUT /topics/:topicId(creates a new version) - Delete a Topic –
DELETE /topics/:topicId(deletes all versions) - Get Topic Tree –
GET /topics/:topicId/tree - Shortest Path –
GET /topics/:startId/path/:endId
- Run via
npm run test:unit
- Run via
npm run test:integration
npm run test
- CRUD for Resources;
- CRUD for Users;
- Add auth middleware to handle user permissions in all endpoints;