Skip to content

Commit

Permalink
add serverName
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowwzw committed Mar 31, 2017
1 parent cf3b6b6 commit cef0c32
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lite-dev-server",
"version": "2.0.1",
"version": "2.1.1",
"description": "This is http file server for develpment. This server supports livereload function and proxy function for your api server.",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const liteDevServer = ({
giveDefaultPage = true,
defaultPageFirst = "index.html",
defaultPageSecond = "index.htm",
serverName = "liteDevServer",
}) => {
const clientScript = fs.readFileSync(`${__dirname}/client.js`, 'utf8').replace(/webSocketPort/g, webSocketPort).replace(/reloadDelay/g, reloadDelayOnClient);
const _transform = function (chunk, enc, cb) {
Expand Down Expand Up @@ -80,7 +81,7 @@ const liteDevServer = ({

const server = http.createServer(async (req, res) => {
const ext = path.extname(req.url);
console.log(chalk.blue(`<-- ${req.url}`));
console.log(chalk.blue(`<-- ${req.url} ${serverName}`));
const matchedProxy = proxy.find(item => {
return req.url.match(item.path) && item.host && item.port;
});
Expand Down
2 changes: 2 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const reloadDelayOnClient = 1000;
const MSG404 = "not found";

const server1 = liteDevServer({
serverName: "server1",
folder: __dirname + "/../tests/static",
watchFolders: [__dirname + "/../tests/static"],
listen: 0,
Expand All @@ -31,6 +32,7 @@ const server1 = liteDevServer({
});

const server2 = liteDevServer({
serverName: "server2",
folder: __dirname + "/../tests/static",
watchFolders: [__dirname + "/../tests/static"],
listen: 0,
Expand Down

0 comments on commit cef0c32

Please sign in to comment.