Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
abschill committed Jul 14, 2022
1 parent 78d83b6 commit 6903f5c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
3 changes: 2 additions & 1 deletion packages/httpuppy/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
lib
*.js
node_modules
node_modules
bin/*.js
1 change: 1 addition & 0 deletions packages/httpuppy/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __fixtures__
docs
.assets
test
bin/*.js
15 changes: 3 additions & 12 deletions packages/httpuppy/bin/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#! /usr/bin/env node
const { color_tag } = require('../lib/internal/include');
const { useServer } = require('../lib');
const cluster = require('cluster');
const { resolve } = require('path');
const { log } = console;
const args = process.argv;


if(!args.includes('--serve')) {
log(color_tag('red', 'error: must provide a directory with the --serve option'));
process.exit(1);
Expand All @@ -18,20 +17,12 @@ if(args.length <= serve_index) {
log(color_tag('red', 'error: no directory provided after --serve'));
process.exit(1);
}

const hot_dir = args[args.indexOf('--serve')+1];
if(cluster.isPrimary) {
const serve_dir = resolve(process.cwd(), hot_dir);
log(color_tag('blue', '[httpuppy]'), color_tag('green', 'server started'));
log(color_tag('green', '\nServer Options:\n'));

log(color_tag('purp', 'port'), ':', port);
log(color_tag('purp', 'static directory:'), serve_dir);
}

const server = useServer({
clustered: true,
port
port,
log_level: 'verbose'
});

server.static('/', hot_dir);
Expand Down
2 changes: 1 addition & 1 deletion packages/httpuppy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "httpuppy",
"version": "0.4.4",
"version": "0.4.5",
"description": "speedy abstraction layer for node web servers with automatic clustering",
"types": "lib/index.d.ts",
"main": "lib/index.js",
Expand Down

0 comments on commit 6903f5c

Please sign in to comment.