{"id":23819815,"url":"https://github.com/kth/kurs-pm-data-api","last_synced_at":"2025-07-11T15:13:26.664Z","repository":{"id":37486175,"uuid":"222703840","full_name":"KTH/kurs-pm-data-api","owner":"KTH","description":"API app to save course memo data edited in kurs-pm-data-admin-web.","archived":false,"fork":false,"pushed_at":"2024-11-22T14:56:10.000Z","size":5425,"stargazers_count":5,"open_issues_count":11,"forks_count":0,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-22T15:40:38.644Z","etag":null,"topics":["express","mongoose","nodejs","react","react-pdf","swagger"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KTH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-19T13:34:21.000Z","updated_at":"2024-11-22T14:54:58.000Z","dependencies_parsed_at":"2024-01-03T16:32:38.410Z","dependency_job_id":"d858975f-27e2-411f-85d5-80e0d4d2a2e8","html_url":"https://github.com/KTH/kurs-pm-data-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"KTH/node-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkurs-pm-data-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkurs-pm-data-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkurs-pm-data-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkurs-pm-data-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KTH","download_url":"https://codeload.github.com/KTH/kurs-pm-data-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232163091,"owners_count":18481581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","mongoose","nodejs","react","react-pdf","swagger"],"created_at":"2025-01-02T07:15:50.565Z","updated_at":"2025-07-11T15:13:26.650Z","avatar_url":"https://github.com/KTH.png","language":"JavaScript","readme":"# Welcome to kurs-pm-data-api 👋\n\n![Version](https://img.shields.io/badge/version-0.8.0-blue.svg?cacheSeconds=2592000)\n![Prerequisite](https://img.shields.io/badge/node-18-blue.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)\n\n## Introduction\n\nThe course information project (KIP) is an initiative at KTH that was launched in 2018 to improve the quality and availability of information about KTH:s courses. The background to the project is, among other things, that it was difficult for the student to find information about the courses and even more difficult to compare information about several courses. The reason for the problems is scattered course information in several places and that there is no uniformity or assigned places for the course information. The project takes measures to consolidate course information into two locations and to present the information in a manner that is uniform for KTH. The student should find the right information about the course, depending on their needs. The result of the project is a public course site where the correct course information is collected and presented uniformly. Also, a tool is developed for teachers to enter and publish course information. Eventually, this will lead to the student making better decisions based on their needs, and it will also reduce the burden on teachers and administration regarding questions and support for the student.\n\nKurs-pm-api is a microservice to save course memos data to database. It accepts data from admin pages ([kurs-pm-data-admin-web](https://github.com/KTH/kurs-pm-data-admin-web)) and serves this data to the public view of course memos ([kurs-pm-web](https://github.com/KTH/kurs-pm-web)). It uses [Node.js](https://nodejs.org/), [Mongoose](https://mongoosejs.com/), `kth-node-cosmos-db`, and is based on [node-api](https://github.com/KTH/node-api).\n\n### 🏠 [Homepage](https://github.com/KTH/kurs-pm-data-api)\n\n## Overview\n\nKurs-pm-api is used to save data in a Azure Cosmos database by using `kth-node-cosmos-db` to establish a connection to Azure. Before using it, the database and collection must be prepared in Azure because it will establish a connection to an existing database, and not try to create it from a code. `Mongoose` is used for creating models and saving data. To present a documentation [Swagger](https://swagger.io/) is used.\n\nAdmin and public pages uses different rights and keys to separate their behaviour.\n\nOnly admin pages may change API data while public pages can only read. Therefore while useing `Swagger`, a developer should choose the correct api key, because some functions will not be shown in details.\n\n### Related Projects\n\n- [kurs-pm-data-admin-web](https://github.com/KTH/kurs-pm-data-admin-web)\n- [kurs-pm-web](https://github.com/KTH/kurs-pm-web)\n- [node-api](https://github.com/KTH/node-api)\n\n## Prerequisites\n\n- Node.js 20\n\n### Secrets for Development\n\nSecrets during local development are stored in a gitignored `.env` file (`env.in` can be used as template for your `.env` file). More details about environment variable setup and secrets can be found in [confluence](https://confluence.sys.kth.se/confluence/x/OYKBDQ).\n\n## Prepare Database in Azure\n\n1. Create database `kursinfo` and manually set Throughput: 400 (Shared). Name of database will be used in a connection string.\n2. In this database create a collection `coursememos` where a shard key is `/courseCode`.\n3. Change a connection string by adding name of database (`kursinfo`) after port slush `[port]/` and as a search query after `?` as `authSorce=kursinfo`:\n\n`mongodb://kurs-pm-data-api-stage-mongodb-kthse:[password]==@kurs-pm-data-api-stage-mongodb-kthse.documents.azure.com:[port]`~~/?ssl=true~~`/kursinfo?ssl=true\u0026authSource=kursinfo`\n\nMore information can be found in Confluence: [Om kursen: Databas och API, connection string](https://confluence.sys.kth.se/confluence/x/a4_KC)\n\n## For Development\n\n### Install\n\n```sh\nnpm install\n```\n\n### Usage\n\nStart the service on [localhost:3001/api/kurs-pm-data/swagger](http://localhost:3001/api/kurs-pm-data/swagger).\n\n```sh\nnpm run start-dev\n```\n\n## In Production\n\nSecrets and docker-compose are located in cellus-registry.\n\n## Run tests\n\n```sh\nnpm run test\n```\n\n## Monitor and Dashboards\n\n### Application Status\n\n[localhost:3001/api/kurs-pm-data/\\_monitor](http://localhost:3001/api/kurs-pm-data/_monitor)\n\n### Branch Information\n\n[localhost:3001/api/kurs-pm-data/\\_about](http://localhost:3001/api/kurs-pm-data/_about)\n\n### Application Insights\n\nTo see more detailed behaviour in project, use `Application Insights`, e.g., `kursinfo-web-stage-application-insights-kthse`.\n\n## Use 🐳\n\nCopy `docker-compose.yml.in` to `docker-compose.yml` and make necessary changes, if any.\n\n```sh\ndocker-compose up\n```\n\n## Deploy in Stage\n\nThe deployment process is described in [Build, release, deploy](https://confluence.sys.kth.se/confluence/x/aY3_Ag). Technical details, such as configuration, is described in [How to deploy your 🐳 application using Cellus-Registy](https://gita.sys.kth.se/Infosys/cellus-registry/blob/master/HOW-TO-DEPLOY.md) and [🔧 How To Configure Your Application For The Pipeline](https://gita.sys.kth.se/Infosys/cellus-registry/blob/master/HOW-TO-CONFIGURE.md).\n\n### Edit secrets.env\n\n```sh\nansible-vault edit secrets.env\n```\n\nPassword find in gsv-key vault\n\n### Configure secrets.env\n\n```\nMONGODB_URI=mongodb://kurs-pm-data-api-mongodb-kthse:[password, specified in Azure]==@kurs-pm-data-api-mongodb-kthse.documents.azure.com:[port, specified in Azure]/kursinfo?ssl=true\u0026authSource=kursinfo\nAPI_KEYS_0=?name=kursinfo-web\u0026apiKey=[generate a password for public pages]\u0026scope=read\nAPI_KEYS_1=?name=kurs-pm-data-admin-web\u0026apiKey=[generate a password for admin page]\u0026scope=write\u0026scope=read\nAPPLICATIONINSIGHTS_CONNECTION_STRING=[Azure, Application insights, connection string, can be found in Overview]\n```\n\n## Author\n\n👤 **KTH**\n\n- Website: https://kth.github.io/\n- Github: [@KTH](https://github.com/KTH)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkurs-pm-data-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkth%2Fkurs-pm-data-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkurs-pm-data-api/lists"}