{"id":23819862,"url":"https://github.com/kth/kth-node-server","last_synced_at":"2026-06-13T20:03:32.808Z","repository":{"id":45639645,"uuid":"67050735","full_name":"KTH/kth-node-server","owner":"KTH","description":"Module for initializing an Express server in a Node.js application.","archived":false,"fork":false,"pushed_at":"2024-04-26T14:07:07.000Z","size":203,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-04-26T15:27:46.006Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-31T15:36:00.000Z","updated_at":"2024-04-26T15:27:55.265Z","dependencies_parsed_at":"2024-04-26T15:27:47.558Z","dependency_job_id":"a6e4d4f6-0a73-4391-aa16-ab9ccaa9297c","html_url":"https://github.com/KTH/kth-node-server","commit_stats":{"total_commits":60,"total_committers":10,"mean_commits":6.0,"dds":0.7666666666666666,"last_synced_commit":"4825fd3811e85f37e107b5815ced93e35c853802"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KTH","download_url":"https://codeload.github.com/KTH/kth-node-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240100517,"owners_count":19747683,"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":[],"created_at":"2025-01-02T07:16:06.814Z","updated_at":"2026-05-08T13:30:18.478Z","avatar_url":"https://github.com/KTH.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @kth/server\n\nA wrapper around express.\nIn it's most basic usage, it just exposes an express app, but it has support for starting with ssl.\n\n## Simple usage, starts a server on http\n\nStart returns a promise that resolves when startup is complete.\n\n```JavaScript\nconst app = require('@kth/server')\napp.start()\n  .then((res) =\u003e {\n    // Do something...\n  })\n```\n\nThe import returns an Express.js instance, so you can add middleware and functions just as in a normal express app:\n\n```JavaScript\napp.get('/', function (req, res) {\n  res.send('Hello world!')\n})\n```\n\nTo stop the instance you call app.close() which returns a promise that resolves when done.\n\n```JavaScript\napp.close()\n  .then(() =\u003e {\n    // Do something...\n  })\n```\n\n## Start server with options\n\n### Secure HTTPS\n\n```JavaScript\nconst app = require('@kth/server')\n\nconst optionsForSsl = {\n  useSsl: true,\n  pfx: '/path/to/file.pfx',\n  passphrase: '/path/to/file.txt',\n  port: 3000, // Optional, defaults to 3000\n  logger: console // Optional, defaults to console\n}\n\napp.start(optionsForSsl)\n```\n\n### Plain HTTP\n\n```JavaScript\nconst app = require('@kth/server')\n\nconst optionsForSsl = {\n  port: 3000, // Optional, defaults to 3000\n  logger: console // Optional, defaults to console\n}\n\napp.start(optionsForSsl)\n```\n\n## Creating a self signed cert for testing\n\n```\n  $ openssl genrsa 2048 \u003e test/certs/private.pem\n  $ openssl req -x509 -days 1000 -new -key test/certs/private.pem -out test/certs/public.pem -subj \"/C=SE/ST=SWEDEN/L=Provo/O=kth-node-server/CN=www.test.com\"\n  $ openssl pkcs12 -export -in test/certs/public.pem -inkey test/certs/private.pem -passout pass:test -out test/certs/withpassphrase.pfx\n  $ echo 'test' \u003e\u003e test/certs/passphrase.txt\n  $ rm test/certs/private.pem test/certs/public.pem\n```\n\n## TODO\n\nTODO: write test for signing requests with cert\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkth-node-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkth%2Fkth-node-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkth-node-server/lists"}