{"id":18265318,"url":"https://github.com/simonh1000/angular-http-server","last_synced_at":"2025-05-16T01:05:12.467Z","repository":{"id":45020434,"uuid":"39731001","full_name":"simonh1000/angular-http-server","owner":"simonh1000","description":"Simple http-server for Single Page Apps (SPAs)","archived":false,"fork":false,"pushed_at":"2025-03-16T06:42:29.000Z","size":308,"stargazers_count":82,"open_issues_count":11,"forks_count":41,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-09T19:51:29.583Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/angular-http-server","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonh1000.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-26T15:48:38.000Z","updated_at":"2025-03-27T13:50:39.000Z","dependencies_parsed_at":"2024-11-21T16:11:58.980Z","dependency_job_id":"576b36b4-ed33-42e3-a9a5-dc9c00d35aa2","html_url":"https://github.com/simonh1000/angular-http-server","commit_stats":{"total_commits":99,"total_committers":17,"mean_commits":5.823529411764706,"dds":"0.46464646464646464","last_synced_commit":"f3a909de12656ba917d962a4823f61146fb61f14"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonh1000%2Fangular-http-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonh1000%2Fangular-http-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonh1000%2Fangular-http-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonh1000%2Fangular-http-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonh1000","download_url":"https://codeload.github.com/simonh1000/angular-http-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"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-05T11:17:49.831Z","updated_at":"2025-05-16T01:05:07.445Z","avatar_url":"https://github.com/simonh1000.png","language":"JavaScript","readme":"# Single Page App dev-server\n\nA simple dev-server designed for all Single Page App (SPA) developers - don't let the reference to angular confuse you. \n\n**This is not, and makes no claims to be, a production server.**\n\nIt returns a file if it exists (ex. your-icon.png, index.html), routes all other requests to index.html (rather than giving a 404 error) so that you SPA's routing can take over. The only time it will error out is if it can't locate the index.html file.\n\nOriginally designed for my Angular work, this dev-server will work with any Single Page App (SPA) framework that uses URL routing (React, Vue, Elm, ...).\n\n## To use:\n\n```sh\nnpm install -g angular-http-server\ncd /path/to/site\nangular-http-server\n```\n\nAnd browse to `localhost:8080`.\n\n## Options\n\nSpecify a port using `-p \u003cport number\u003e`\n\n```sh\nangular-http-server -p 9000\n```\n\nOpen in a default browser automatically by using `--open` alias `-o`\n\n```sh\nangular-http-server --open\n```\n\nHTTPS can be enabled (using a generated self-signed certificate) with `--https` or `--ssl`\n\n```sh\nangular-http-server --https\n```\n\nYou may manually specify the paths to your self-signed certificate using the `--key` and `--cert` flags\n\n```sh\nangular-http-server --https --key ./secret/key.pem --cert ./secret/cert.pem\n```\n\n[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) can be enabled with the --cors flag\n\n```sh\nangular-http-server --cors\n```\n\nSpecify a path to serve from\n\n```sh\nangular-http-server --path example\n```\n\nSpecify the base href of the application, without leading slash\n\n```sh\nangular-http-server --baseHref myapp\n```\n\nSpecify the rootFile of the application\n\n```sh\nangular-http-server --rootFile myindex.html\n```\n\nSpecify the host of the application. It's used when open is true to redirect browser to navigate for the host. Example: http://mydomain.local:8080\n\n```sh\nangular-http-server --open --host mydomain.local\n```\n\nDisable logging\n\n```sh\nangular-http-server --silent\n```\n\nAll options can be specified by a config file, optionally read via `--config` flag.\nCLI options take precedence over any options read from the config file.\n\n```sh\nangular-http-server --config configs/angular-http-server.config.js\n```\n\nFeedback via: https://github.com/simonh1000/angular-http-server\n\n## Config File\n\nThe config file can either export an object of parameters, or a function that will be passed in the parsed `argv` from minimalist.\n\nSimple example:\n\n```js\nmodule.exports = {\n    p: 8081,\n    cors: true,\n    silent: true,\n};\n```\n\nComplicated example:\n\n```js\nmodule.exports = (argv) =\u003e {\n    const config = {\n        cors: true,\n    };\n\n    if (argv.p === 443) {\n        config.ssl = true;\n    }\n\n    return config;\n};\n```\n\n## Http proxy\n\n#### Enabling proxy\n\nThe server contains a simple http proxy.\nThe proxy must be configured in the config file.\nTo enable this proxy:\n\n```sh\nangular-http-server --config configs/angular-http-server.config.js --useProxy true\n```\n\n#### configuring proxy\n\nTo configure the proxy add a proxy object to your config file.\nThe proxy should be an array of configs with two required properties: a forward property which must be a string array listing url parts which should trigger the proxy, and a target property which should define the target to proxy to.\nThe config can also contain an optional protocol option, when this is absent the server will default to https\n\nsimple example:\n\n```js\nmodule.exports = {\n    proxy: [\n        {\n            forward: [\"api/example-api\", \"api-proxy/example\"],\n            target: \"localhost:5000\",\n            protocol: \"http\",\n        },\n        {\n            forward: [\"api/example-api-2\", \"api-proxy-2/example\"],\n            target: \"localhost:6000\",\n        },\n    ],\n};\n```\n\n## Self-Signed HTTPS Use\n\n#### Production\n\nThe `--https` or `--ssl` flags are intended for **development and/or testing purposes only**. Self-signed certificates do not properly verify the identity of the web app and they will cause an end-users web browser to display an error. This can be accomplished by using the self-signed certificate generated when you pass the `--https`/`--ssl` flag. An example of when you should use this feature is with end-to-end testing suites such as [Protractor](http://www.protractortest.org/) or other suites which require the SPA application to be served over https.\n\n## Changelog\n\n-   1.12.0 - adds host support (thanks jpwerka)\n-   1.11.0 - adds proxy support (thanks AVierwind)\n-   1.10.0 - adds --rootPath (thanks Aakash)\n-   1.9.0 - adds --baseHref (thanks bertbaron)\n-   1.8.0 - rewrite of path resolution (thanks dpraul)\n-   1.7.0 - add option to include own ssl certificate (thanks dpraul)\n-   1.6.0 - add --config option (thanks dpraul)\n-   1.5.0 - add --open option (thanks tluanga34)\n-   1.4.0 - add --path option (thanks nick-bogdanov)\n\n## Contributing\n\nContributions are welcome, but do create an issue first to discuss.\n\nUse prettier for formatting\n\n## Testing\n\nRun unit tests with\n\n```sh\n$ npm run test\n```\n\nTesting - try:\n\n```sh\nnode angular-http-server.js --path example --ssl -p 9000\n```\n","funding_links":[],"categories":["Development Utilities"],"sub_categories":["Networking"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonh1000%2Fangular-http-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonh1000%2Fangular-http-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonh1000%2Fangular-http-server/lists"}