Skip to content

Commit 4dc1a02

Browse files
committed
Merge branch 'tluanga34-master'
2 parents c6d82e3 + e5a08cd commit 4dc1a02

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Angular-HTTP-Server
1+
# Single Page App dev-server
22

3-
A very simple application server designed for Single Page App (SPA) developers.
3+
A simple dev-server designed for Single Page App (SPA) developers. **`angular-http-server` is not, and makes no claims to be, a production server.**
44

5-
It returns a file to the browser if it exists (ex. your-icon.png, index.html) and if can't find a file that matches a given URL it re-directs you to index.html rather than giving a 404 error. The only time it will error out is if it can't locate the index.html file.
5+
It 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 SPO's routing can take over. The only time it will error out is if it can't locate the index.html file.
66

7-
Originally designed for my Angular work, this server will work with any Single Page App (SPA) framework that uses a router to change the URL (React, Vue JS, Elm,...).
7+
Originally designed for my Angular work, this dev-server will work with any Single Page App (SPA) framework that uses URL routing (React, Vue JS, Elm,...).
88

99
## To use:
1010

@@ -24,6 +24,12 @@ Specify a port using `-p <port number>`
2424
angular-http-server -p 9000
2525
```
2626

27+
Open in a default browser automatically by using `--open` alias `-o`
28+
29+
```sh
30+
angular-http-server --open
31+
```
32+
2733
HTTPS can be enabled (using a generated self-signed certificate) with `--https` or `--ssl`
2834

2935
```sh
@@ -52,18 +58,15 @@ Feedback via: https://github.com/simonh1000/angular-http-server
5258

5359
#### Production
5460

55-
**`angular-http-server` is not, and makes no claims to be, a production server.** The `--https` or `--ssl` flagsare 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.
56-
57-
Within a production env use `angular-http-server` in http mode and forward traffic to it from an SSL-enabled reverse-proxy server (ie. [NGINX](https://www.nginx.com/resources/admin-guide/reverse-proxy/)).
58-
59-
#### Development
60-
Only use `angular-http-server` with a self-signed certificate for development and/or testing. 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 actively served.
61+
The `--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. Only use `angular-http-server` with a self-signed certificate for development and/or testing. 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 actively served.
6162

6263
## Changelog
6364

65+
1.5.0 - add --open option
6466
1.4.0 - add --path option
6567

6668
## Dev notes
69+
6770
Test latest version, e.g.
6871
```sh
6972
node angular-http-server.js --path example --ssl -p 9000

angular-http-server.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ var path = require("path");
77
var pem = require('pem');
88
var https = require('https');
99
var http = require("http");
10+
var opn = require('opn');
11+
12+
1013

1114
var server;
1215

@@ -34,6 +37,9 @@ if (argv.ssl || argv.https) {
3437

3538
function start() {
3639
server.listen(getPort(), function () {
40+
if(argv.open == true || argv.o) {
41+
opn(((argv.ssl)?'https':'http')+"://localhost:"+getPort());
42+
}
3743
return console.log("Listening on " + getPort());
3844
});
3945
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-http-server",
3-
"version": "1.4.5",
3+
"version": "1.5.0",
44
"author": "Simon Hampton",
55
"license": "ISC",
66
"description": "Simple http server for developers that supports apps with client side routing",
@@ -37,6 +37,7 @@
3737
"dependencies": {
3838
"mime": "^1.3.6",
3939
"minimist": "^1.2.0",
40+
"opn": "^5.3.0",
4041
"pem": "^1.9.7"
4142
}
4243
}

0 commit comments

Comments
 (0)