simple-angular-server
Advanced tools
Comparing version 0.3.8 to 0.3.9
37
app.js
#!/usr/bin/env node | ||
// Change FRONT-END PORT here | ||
var PORT = 3000; | ||
// Change directory "public" here | ||
var completePath = './'; | ||
var filterPath; | ||
/*Command line arguments | ||
* Command node app.js [PORT] [PUBLIC-DIR-PATH]*/ | ||
if (process.argv.length > 1) { | ||
PORT = (process.argv[2] && !isNaN(process.argv[2]) && +process.argv[2] ) || PORT; | ||
completePath = process.argv[3] || completePath; | ||
} | ||
var argv = require('optimist') | ||
.default('port', 3000) | ||
.default('dir', '') | ||
.argv; | ||
var express = require('express'); | ||
var currentDir = process.cwd(); | ||
if (completePath.match(/\.\//)) { | ||
filterPath = completePath.replace(/\.\//i,""); | ||
completePath = currentDir + '/' + filterPath; | ||
} | ||
var path = require('path'); | ||
// Setup server | ||
@@ -29,7 +14,5 @@ var app = express(); | ||
app.use(express.static(completePath)); | ||
app.set('appPath', completePath); | ||
app.use(express.static(path.resolve(currentDir,argv.dir))); | ||
app.set('appPath', path.resolve(currentDir,argv.dir)); | ||
// Insert routes below | ||
// All undefined asset or api routes should return a 404 | ||
@@ -40,3 +23,2 @@ app.route('/:url(api|auth|components|app|bower_components|assets)/*') | ||
}); | ||
// All other routes should redirect to the index.html | ||
@@ -47,7 +29,6 @@ app.route('/*') | ||
}); | ||
// Start server | ||
server.listen(PORT, function () { | ||
console.log('Angular Server PORT: %d ', PORT); | ||
server.listen(argv.port, function () { | ||
console.log('Angular Server PORT: %d ', argv.port); | ||
console.log('Server Public Directory Path: %s ', app.get('appPath')); | ||
}); |
{ | ||
"name": "simple-angular-server", | ||
"version": "0.3.8", | ||
"bin": {"angularserver": "app.js"}, | ||
"version": "0.3.9", | ||
"bin": { | ||
"angularserver": "app.js" | ||
}, | ||
"description": "Simple angular server to serve angular page's with HTML5 mode on", | ||
"dependencies": { | ||
"express": "~4.0.0" | ||
"express": "~4.0.0", | ||
"optimist": "^0.6.1" | ||
}, | ||
@@ -24,6 +27,28 @@ "keywords": [ | ||
{ | ||
"name": "Kashish Gupta", | ||
"name": "kashishgupta1990", | ||
"email": "kashishgupta1990@yahoo.com" | ||
} | ||
] | ||
} | ||
], | ||
"gitHead": "c078532930c5e421f9cbca715fcab315df820bb0", | ||
"bugs": { | ||
"url": "https://github.com/kashishgupta1990/simple-angular-server/issues" | ||
}, | ||
"homepage": "https://github.com/kashishgupta1990/simple-angular-server", | ||
"_id": "simple-angular-server@0.3.8", | ||
"scripts": {}, | ||
"_shasum": "b0fb093a5c9cfb932f2c0d0bb581550635c9c261", | ||
"_from": "simple-angular-server@", | ||
"_npmVersion": "2.7.4", | ||
"_nodeVersion": "0.12.2", | ||
"_npmUser": { | ||
"name": "kashishgupta1990", | ||
"email": "kashishgupta1990@yahoo.com" | ||
}, | ||
"dist": { | ||
"shasum": "b0fb093a5c9cfb932f2c0d0bb581550635c9c261", | ||
"tarball": "http://registry.npmjs.org/simple-angular-server/-/simple-angular-server-0.3.9.tgz" | ||
}, | ||
"directories": {}, | ||
"_resolved": "https://registry.npmjs.org/simple-angular-server/-/simple-angular-server-0.3.9.tgz", | ||
"readme": "ERROR: No README data found!" | ||
} |
@@ -29,12 +29,14 @@ # Angular Server | ||
```sh | ||
Syntax: angularserver [PORT] [Complete Directory Path] | ||
Syntax: angularserver --port 8080 --dir {path:like: ./app or /home/user/myapp} | ||
``` | ||
> Default [`PORT`:`3000`] and [`Directory Path`:`Your Current Directory`] | ||
> Default [`port`:`3000`] and [`Directory Path`:`Your Current Directory`] | ||
> Our command would be like.. | ||
```sh | ||
$ angularserver 8080 /home/user/myAngularApp/dist | ||
$ angularserver --port 8080 --dir /home/user/myAngularApp/dist | ||
``` | ||
> If we are in project directory | ||
```sh | ||
$ angularserver 8080 ./dist | ||
$ angularserver --port 8080 --dir ./dist | ||
``` | ||
@@ -41,0 +43,0 @@ ### Download Link: |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
4154
2
1
54
2
27
+ Addedoptimist@^0.6.1
+ Addedminimist@0.0.10(transitive)
+ Addedoptimist@0.6.1(transitive)
+ Addedwordwrap@0.0.3(transitive)