{"id":21082308,"url":"https://github.com/olsonpm/koa-vue-ssr_init-dev-server","last_synced_at":"2025-03-14T04:43:15.119Z","repository":{"id":80606369,"uuid":"123195928","full_name":"olsonpm/koa-vue-ssr_init-dev-server","owner":"olsonpm","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-28T16:18:01.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T23:46:02.532Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/olsonpm.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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":"2018-02-27T22:21:44.000Z","updated_at":"2018-07-28T16:16:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"c99ddb97-fbc0-4a8a-94cb-cf63a88df7a1","html_url":"https://github.com/olsonpm/koa-vue-ssr_init-dev-server","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fkoa-vue-ssr_init-dev-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fkoa-vue-ssr_init-dev-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fkoa-vue-ssr_init-dev-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olsonpm%2Fkoa-vue-ssr_init-dev-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olsonpm","download_url":"https://codeload.github.com/olsonpm/koa-vue-ssr_init-dev-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243526853,"owners_count":20305112,"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":"2024-11-19T20:13:37.832Z","updated_at":"2025-03-14T04:43:15.111Z","avatar_url":"https://github.com/olsonpm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Initialize A Koa/Vue/Ssr Development Server\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [What Is This](#what-is-this)\n- [Why Create It](#why-create-it)\n- [This Module's Responsibilities](#this-modules-responsibilities)\n- [API](#api)\n- [Reference](#reference)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n### What Is This\nThis module is basically a cleaned up version of\n[vue-hackernews-2.0](https://github.com/vuejs/vue-hackernews-2.0)'s\n[setup-dev-server.js](https://github.com/vuejs/vue-hackernews-2.0/blob/master/build/setup-dev-server.js)\nwhich utilizes koa instead of express.  This module is consumed by\n[koa-vue-ssr_proof-of-concept](https://github.com/olsonpm/koa-vue-ssr_proof-of-concept),\nwhich again was written using vue-hackernews-2.0 as reference.\n\n### Why Create it\nIn the hackernews project, the `setup-dev-server.js` file was very complex.  So\nwhen I created my own vue ssr project it was beneficial to isolate that\ncomplexity into its own module.  The intention is to keep the rest of the server\ncode focused on problems particular to the application.\n\n### This Module's Responsibilities\n1. Watches the template html file and updates the vue renderer when modified\n2. Connects [koa-webpack](https://github.com/shellscape/koa-webpack) to the koa\n   application passing it the client webpack compiler for HMR\n3. Attaches a 'done' event handler to the client webpack compiler and updates\n   the vue renderer with the new\n   [clientManifest](https://ssr.vuejs.org/en/api.html#clientmanifest)\n4. Runs the ssr webpack compiler's `watch()` method, updating the renderer\n   with the new ssr bundle every pass.\n5. Returns a promise that:\n   - resolves when both the bundle and clientManifest are created.\n   - rejects if there is an error prior to the resolve.  Errors occuring during\n     the watch processes after the promise settles will be logged to stderr.\n\n### API\n\n```js\n// All arguments are required\ninitDevServer({\n  koaApp: \u003cinstanceof Koa\u003e\n  webpackConfigs: {\n    client: \u003cwebpack configuration\u003e\n    ssr: \u003cwebpack configuration\u003e\n  }\n  webpackHotClientPort: \u003cinteger\u003e\n  templatePath: \u003cpath to index html file\u003e\n})\n\n// resolves to\n.then({\n  koaApp: \u003cinstanceof Koa\u003e\n  getRenderer: () =\u003e \u003cinstanceof BundleRenderer\u003e\n})\n```\n\n### Reference\n- [BundleRenderer](https://ssr.vuejs.org/en/api.html#class-bundlerenderer)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folsonpm%2Fkoa-vue-ssr_init-dev-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folsonpm%2Fkoa-vue-ssr_init-dev-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folsonpm%2Fkoa-vue-ssr_init-dev-server/lists"}