Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lwsjs/local-web-server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 32dd3466544eb0e380c13b44c871f29d1e146693
Choose a base ref
...
head repository: lwsjs/local-web-server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9f45cc467085e1d2967b03afbb65be297cee9cb4
Choose a head ref

Commits on May 5, 2021

  1. add discussions link to readme

    75lb committed May 5, 2021
    Copy the full SHA
    f334ecf View commit details

Commits on Jun 3, 2021

  1. drop support for node < v14

    rewrite using ESM
    75lb committed Jun 3, 2021
    Copy the full SHA
    22b6183 View commit details

Commits on Jun 9, 2021

  1. update licence and deps

    75lb committed Jun 9, 2021
    Copy the full SHA
    29be043 View commit details
  2. 5.0.0-0

    75lb committed Jun 9, 2021
    Copy the full SHA
    f5c51ac View commit details

Commits on Jul 6, 2021

  1. add Github CI

    75lb committed Jul 6, 2021
    Copy the full SHA
    d8ee841 View commit details
  2. upgrade deps

    75lb committed Jul 6, 2021
    Copy the full SHA
    82afa72 View commit details
  3. 5.0.0

    75lb committed Jul 6, 2021
    Copy the full SHA
    7bcff10 View commit details

Commits on Aug 6, 2021

  1. Copy the full SHA
    59e7f7c View commit details
  2. 5.1.0

    75lb committed Aug 6, 2021
    Copy the full SHA
    5e02b95 View commit details

Commits on Aug 14, 2021

  1. upgrade deps

    75lb committed Aug 14, 2021
    Copy the full SHA
    81969bc View commit details

Commits on Aug 25, 2021

  1. fix readme gifs

    75lb committed Aug 25, 2021
    Copy the full SHA
    7aa8654 View commit details
  2. 5.1.1

    75lb committed Aug 25, 2021
    Copy the full SHA
    b8fa40d View commit details

Commits on Jan 10, 2022

  1. upgrade deps and dates

    75lb committed Jan 10, 2022
    Copy the full SHA
    897034e View commit details

Commits on Mar 13, 2022

  1. lws-cors: support 'Cross-Origin-Opener-Policy' and 'Cross-Origin-Embe…

    …dder-Policy' headers
    75lb committed Mar 13, 2022
    Copy the full SHA
    25c2d74 View commit details
  2. add node v17 to CI

    75lb committed Mar 13, 2022
    Copy the full SHA
    9f9fb49 View commit details
  3. 5.2.0

    75lb committed Mar 13, 2022
    Copy the full SHA
    5e6580c View commit details

Commits on May 28, 2022

  1. upgrade deps to fix a couple of issues introduced by node v18

    127.0.0.1 now shows in the network interface list again.. pfx file updated to fix --https and --http2 modes on Linux
    75lb committed May 28, 2022
    Copy the full SHA
    3a01457 View commit details
  2. 5.2.1

    75lb committed May 28, 2022
    Copy the full SHA
    1afdc57 View commit details

Commits on Oct 25, 2022

  1. add node v19 to CI

    75lb committed Oct 25, 2022
    Copy the full SHA
    e94cea0 View commit details

Commits on Feb 7, 2023

  1. Copy the full SHA
    c5750e6 View commit details
  2. 5.3.0

    75lb committed Feb 7, 2023
    Copy the full SHA
    88839a0 View commit details

Commits on Jan 8, 2024

  1. Copy the full SHA
    1f30517 View commit details
  2. 5.3.1

    75lb committed Jan 8, 2024
    Copy the full SHA
    9f45cc4 View commit details
28 changes: 28 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12, 14, 16, 18, 19]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm test
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013-20
Lloyd Brookes <75pound@gmail.com>
Copyright (c) 2013-2023 Lloyd Brookes <75pound@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@
[![npm module downloads](https://badgen.net/npm/dt/local-web-server)](https://www.npmjs.org/package/local-web-server)
[![Gihub repo dependents](https://badgen.net/github/dependents-repo/lwsjs/local-web-server)](https://github.com/lwsjs/local-web-server/network/dependents?dependent_type=REPOSITORY)
[![Gihub package dependents](https://badgen.net/github/dependents-pkg/lwsjs/local-web-server)](https://github.com/lwsjs/local-web-server/network/dependents?dependent_type=PACKAGE)
[![Build Status](https://travis-ci.org/lwsjs/local-web-server.svg?branch=master)](https://travis-ci.org/lwsjs/local-web-server)
[![Node.js CI](https://github.com/lwsjs/local-web-server/actions/workflows/node.js.yml/badge.svg)](https://github.com/lwsjs/local-web-server/actions/workflows/node.js.yml)
[![Coverage Status](https://coveralls.io/repos/github/lwsjs/local-web-server/badge.svg)](https://coveralls.io/github/lwsjs/local-web-server)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)

*Upgraders, please read the [release notes](https://github.com/lwsjs/local-web-server/releases)*.
*Upgraders, please read the [release notes](https://github.com/lwsjs/local-web-server/releases). For feedback, discussion and support see [here](https://github.com/lwsjs/local-web-server/discussions).*

# local-web-server

@@ -42,7 +42,7 @@ Listening on http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:

This clip demonstrates static hosting plus a couple of log output formats - `dev` and `stats`.

<img src="https://imgur.com/download/NJC3POY" width="618px" title="Static static log output">
<img src="https://s9.gifyu.com/images/NJC3POY---Imgur.gif" width="618px" title="Static static log output">


### Single Page Application
@@ -59,7 +59,7 @@ With a static site, requests for typical SPA paths (e.g. `/user/1`, `/login`) wo

[SPA tutorial](https://github.com/lwsjs/local-web-server/wiki/How-to-serve-a-Single-Page-Application-(SPA)).

<img src="https://imgur.com/download/IQVmi8v" title="SPA">
<img src="https://s9.gifyu.com/images/IQVmi8v---Imgur.gif" width="618px" title="SPA">

### URL rewriting and proxied requests

@@ -75,7 +75,7 @@ $ ws --rewrite '/posts/(.*) -> https://jsonplaceholder.typicode.com/posts/$1'

This clip demonstrates the above plus use of `--static.extensions` to specify a default file extension and `--verbose` to monitor activity.

<img src="https://imgur.com/download/3flcbJn" width="618px" title="Proxy json requests to remote resource">
<img src="https://s9.gifyu.com/images/3flcbJn---Imgur.gif" width="618px" title="Proxy json requests to remote resource">

### HTTPS and HTTP2

@@ -119,4 +119,4 @@ $ npm install -g local-web-server

* * *

&copy; 2013-20 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
&copy; 2013-23 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
10 changes: 0 additions & 10 deletions bin/cli.js

This file was deleted.

4 changes: 4 additions & 0 deletions bin/cli.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node
import WsCli from '../lib/cli-app.mjs'
const cli = new WsCli()
cli.start()
19 changes: 0 additions & 19 deletions index.js

This file was deleted.

22 changes: 22 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Lws from 'lws'
import defaultStack from './lib/default-stack.mjs'
import currentModulePaths from 'current-module-paths'
const { __dirname } = currentModulePaths(import.meta.url)

/**
* @module local-web-server
*/

/**
* @alias module:local-web-server
*/
class LocalWebServer extends Lws {
_getDefaultConfig () {
return Object.assign(super._getDefaultConfig(), {
moduleDir: [process.cwd(), __dirname],
stack: defaultStack
})
}
}

export default LocalWebServer
26 changes: 15 additions & 11 deletions lib/cli-app.js → lib/cli-app.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
const LwsCli = require('lws/lib/cli-app')
const path = require('path')
import LwsCli from 'lws/lib/cli-app.mjs'
import path from 'path'
import defaultStack from './default-stack.mjs'
import { promises as fs } from 'fs'

import getModulePaths from 'current-module-paths'
const __dirname = getModulePaths(import.meta.url).__dirname

class WsCli extends LwsCli {
execute (options) {
async execute (options) {
if (options.defaultStack) {
const list = require('./default-stack')
this.log(list)
this.log(defaultStack)
} else {
return super.execute(options)
}
}

getDefaultOptions () {
return Object.assign(super.getDefaultOptions(), {
stack: require('./default-stack').slice(),
moduleDir: [ '.', path.resolve(__dirname, '..') ]
stack: defaultStack.slice(),
moduleDir: [process.cwd(), path.resolve(__dirname, '..')]
})
}

@@ -52,10 +56,10 @@ class WsCli extends LwsCli {
return sections
}

showVersion () {
const pkg = require(path.resolve(__dirname, '..', 'package.json'))
this.log(pkg.version)
async showVersion () {
const version = JSON.parse(await fs.readFile(path.resolve(__dirname, '..', 'package.json'), 'utf8')).version
this.log(version)
}
}

module.exports = WsCli
export default WsCli
2 changes: 1 addition & 1 deletion lib/default-stack.js → lib/default-stack.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = [
export default [
'lws-basic-auth',
'lws-body-parser',
'lws-request-monitor',
Loading