Comments (1)
Here is http-server where it is showing a syntax error I guess
#!/usr/bin/env node
var colors = require('colors'),
httpServer = require('../lib/http-server'),
portfinder = require('portfinder'),
opener = require('opener'),
argv = require('optimist')
.boolean('cors')
.argv;
if (argv.h || argv.help) {
console.log([
"usage: http-server [path] [options]",
"",
"options:",
" -p Port to use [8080]",
" -a Address to use [0.0.0.0]",
" -d Show directory listings [true]",
" -i Display autoIndex [true]",
" -e --ext Default file extension if none supplied [none]",
" -s --silent Suppress log messages from output",
" --cors Enable CORS via the 'Access-Control-Allow-Origin' header",
" -o [path] Open browser window after starting the server",
" -c Cache time (max-age) in seconds [3600], e.g. -c10 for 10 seconds.",
" To disable caching, use -c-1.",
"",
" -P --proxy Fallback proxy if the request cannot be resolved. e.g.: http://someurl.com",
"",
" -S --ssl Enable https.",
" -C --cert Path to ssl cert file (default: cert.pem).",
" -K --key Path to ssl key file (default: key.pem).",
"",
" -r --robots Respond to /robots.txt [User-agent: *\nDisallow: /]",
" -h --help Print this list and exit."
].join('\n'));
process.exit();
}
var port = argv.p || parseInt(process.env.PORT, 10),
host = argv.a || '0.0.0.0',
log = (argv.s || argv.silent) ? (function () {}) : console.log,
ssl = !!argv.S || !!argv.ssl,
proxy = argv.P || argv.proxy,
requestLogger;
if (!argv.s && !argv.silent) {
requestLogger = function(req, res, error) {
var date = (new Date).toUTCString();
if (error) {
log('[%s] "%s %s" Error (%s): "%s"', date, req.method.red, req.url.red, error.status.toString().red, error.message.red);
} else {
log('[%s] "%s %s" "%s"', date, req.method.cyan, req.url.cyan, req.headers['user-agent']);
}
};
}
if (!port) {
portfinder.basePort = 8080;
portfinder.getPort(function (err, port) {
if (err) throw err;
listen(port);
});
} else {
listen(port);
}
function listen(port) {
var options = {
root: argv._[0],
cache: argv.c,
showDir: argv.d,
autoIndex: argv.i,
robots: argv.r || argv.robots,
ext: argv.e || argv.ext,
logFn: requestLogger,
proxy: proxy
};
if (argv.cors) {
options.cors = true;
}
if (ssl) {
options.https = {
cert: argv.C || argv.cert || 'cert.pem',
key: argv.K || argv.key || 'key.pem'
};
}
var server = httpServer.createServer(options);
server.listen(port, host, function () {
var canonicalHost = host === '0.0.0.0' ? '127.0.0.1' : host,
protocol = ssl ? 'https:' : 'http:';
log('Starting up http-server, serving '.yellow
+ server.root.cyan
+ (ssl ? (' through'.yellow + ' https'.cyan) : '')
+ ' on: '.yellow
+ (protocol + '//' + host + ':' + port).cyan);
if (typeof proxy === 'string') {
log('Unhandled requests will be served from: ' + proxy);
}
log('Hit CTRL-C to stop the server');
if (argv.o) {
opener(
protocol + '//' + canonicalHost + ':' + port,
{ command: argv.o !== true ? argv.o : null }
);
}
});
}
if (process.platform === 'win32') {
require('readline').createInterface({
input: process.stdin,
output: process.stdout
}).on('SIGINT', function () {
process.emit('SIGINT');
});
}
process.on('SIGINT', function() {
log('http-server stopped.'.red);
process.exit();
});
from angular-client-side-auth.
Related Issues (20)
- Replace $cookieStore to $cookies HOT 1
- Server depends on a file located in the client directory HOT 1
- book mark HOT 2
- npm install throwing me to include npm-debug.log
- react js issue
- npm run build error HOT 3
- Can't start the "npm run dev" on my ubuntu 17.10 Laravel 5.5
- I am new with Node and it gives me error whenever i run npm start command.Can anyone please help me....
- i have error when i write npm start
- I'm new with Node
- Unresolved variable or type routingConfig HOT 2
- Google Logout HOT 2
- How about using JWT instead of cookies HOT 5
- "data.access" in toState is always false HOT 2
- Integration with Django HOT 3
- Social sites login
- Question about passing the user to HTTP GET * HOT 1
- Use ng-if instead CSS HOT 5
- any sample with asp.net mvc HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-client-side-auth.