All Projects β†’ lwsjs β†’ Local Web Server

lwsjs / Local Web Server

Licence: other
A lean, modular web server for rapid full-stack development.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Local Web Server

Uwsgi Nginx Docker
Docker image with uWSGI and Nginx for applications in Python 3.5 and above and Python 2.7 (as Flask) in a single container. Optionally with Alpine Linux.
Stars: ✭ 466 (-49.13%)
Mutual labels:  server, web-server, webapp
Appy
πŸš€ A full stack boilerplate web app
Stars: ✭ 225 (-75.44%)
Mutual labels:  full-stack, backend, webapp
Electron Serve
Static file serving for Electron apps
Stars: ✭ 310 (-66.16%)
Mutual labels:  server, single-page-app
Kanary
A minimalist web framework for building REST APIs in Kotlin/Java.
Stars: ✭ 319 (-65.17%)
Mutual labels:  server, backend
Cppwebframework
​The C++ Web Framework (CWF) is a MVC web framework, Open Source, under MIT License, using C++ with Qt to be used in the development of web applications.
Stars: ✭ 348 (-62.01%)
Mutual labels:  server, webapp
Android Pwa Wrapper
Android Wrapper to create native Android Apps from offline-capable Progressive Web Apps
Stars: ✭ 265 (-71.07%)
Mutual labels:  progressive-web-app, single-page-app
Ios Pwa Wrapper
An iOS Wrapper application to create a native iOS App from an offline-capable Progressive Web App.
Stars: ✭ 268 (-70.74%)
Mutual labels:  progressive-web-app, single-page-app
Hi Nginx
A fast and robust web server and application server for C++,Python,Lua ,Java,quickjs language
Stars: ✭ 346 (-62.23%)
Mutual labels:  server, web-server
Systemizer
A system design tool that allows you to simulate data flow of distributed systems.
Stars: ✭ 1,219 (+33.08%)
Mutual labels:  web-development, backend
Udash Core
Scala framework for building beautiful and maintainable web applications.
Stars: ✭ 405 (-55.79%)
Mutual labels:  backend, webapp
Live Torrent
Torrent Web Client
Stars: ✭ 546 (-40.39%)
Mutual labels:  server, backend
ambianic-ui
PWA for managing Ambianic Edge devices (smart cameras).
Stars: ✭ 32 (-96.51%)
Mutual labels:  progressive-web-app, webapp
wordpress
Free PWA & SPA for Wordpress & Woocommerce
Stars: ✭ 103 (-88.76%)
Mutual labels:  progressive-web-app, single-page-app
Wpn Xm
WPN-XM is a web server stack for PHP development on Windows.
Stars: ✭ 280 (-69.43%)
Mutual labels:  web-development, server
webviewhs
🌐 A Haskell binding to the webview library created by Serge Zaitsev.
Stars: ✭ 109 (-88.1%)
Mutual labels:  single-page-app, webapp
Nock Nock
πŸšͺ Monitor and validate your websites to maintain maximum uptime.
Stars: ✭ 339 (-62.99%)
Mutual labels:  server, web-server
Servor
Dependency free file server for single page app development
Stars: ✭ 672 (-26.64%)
Mutual labels:  server, single-page-app
heroku-flask-template
A simple, fast and easy-to-deploy Heroku ready flask web app template written in Python.
Stars: ✭ 26 (-97.16%)
Mutual labels:  backend, webapp
workflowmanager-viewer-js
Source code for ArcGIS Workflow Manager JavaScript viewer - Manage your workflows on the web.
Stars: ✭ 23 (-97.49%)
Mutual labels:  web-development, webapp
Binserve
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. βš‘οΈπŸ¦€
Stars: ✭ 401 (-56.22%)
Mutual labels:  server, web-server

view on npm npm module downloads Gihub repo dependents Gihub package dependents Build Status Coverage Status js-standard-style

Upgraders, please read the release notes.

local-web-server

A lean, modular web server for rapid full-stack development.

  • Supports HTTP, HTTPS and HTTP2.
  • Small and 100% personalisable. Load and use only the behaviour required by your project.
  • Attach a custom view to personalise how activity is visualised.
  • Programmatic and command-line interfaces.

Use this tool to:

  • Build any type of front-end web application (static, dynamic, Single Page App, Progessive Web App, React etc).
  • Prototype a back-end service (REST API, microservice, websocket, Server Sent Events service etc).
  • Monitor activity, analyse performance, experiment with caching strategy etc.

Local-web-server is a distribution of lws bundled with a "starter pack" of useful middleware.

Synopsis

This package installs the ws command-line tool (take a look at the usage guide).

Static web site

Running ws without any arguments will host the current directory as a static web site. Navigating to the server will render a directory listing or your index.html, if that file exists.

$ ws
Listening on http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.100:8000

Static files tutorial.

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

Single Page Application

Serving a Single Page Application (an app with client-side routing, e.g. a React or Angular app) is as trivial as specifying the name of your single page:

$ ws --spa index.html

With a static site, requests for typical SPA paths (e.g. /user/1, /login) would return 404 Not Found as a file at that location does not exist. However, by marking index.html as the SPA you create this rule:

If a static file is requested (e.g. /css/style.css) then serve it, if not (e.g. /login) then serve the specified SPA and handle the route client-side.

SPA tutorial.

URL rewriting and proxied requests

Another common use case is to forward certain requests to a remote server.

The following command proxies blog post requests from any path beginning with /posts/ to https://jsonplaceholder.typicode.com/posts/. For example, a request for /posts/1 would be proxied to https://jsonplaceholder.typicode.com/posts/1.

$ ws --rewrite '/posts/(.*) -> https://jsonplaceholder.typicode.com/posts/$1'

Rewrite tutorial.

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

HTTPS and HTTP2

For HTTPS or HTTP2, pass the --https or --http2 flags respectively. See the wiki for further configuration options and a guide on how to get the "green padlock" in your browser.

$ ws --http2
Listening at https://mba4.local:8000, https://127.0.0.1:8000, https://192.168.0.200:8000

Built-in middleware stack

If you do not supply a custom middleware stack via the --stack option the following default stack will be used. It's designed to cover most typical web development scenarios.

Name Description
↓ Basic Auth Password-protect a server using Basic Authentication
↓ Body Parser Parses the request body, making ctx.request.body available to downstream middleware.
↓ Request Monitor Feeds traffic information to the --verbose output.
↓ Log Outputs an access log or stats view to the console.
↓ Cors Support for setting Cross-Origin Resource Sharing (CORS) headers
↓ Json Pretty-prints JSON responses.
↓ Rewrite URL Rewriting. Use to re-route requests to local or remote destinations.
↓ Blacklist Forbid access to sensitive or private resources
↓ Conditional Get Support for HTTP Conditional requests.
↓ Mime Customise the mime-type returned with any static resource.
↓ Compress Compress responses using gzip.
↓ SPA Support for Single Page Applications.
↓ Static Serves static files.
↓ Index Serves directory listings.

Further Documentation

See the wiki for plenty more documentation and tutorials.

Install

$ npm install -g local-web-server

Β© 2013-20 Lloyd Brookes <[email protected]>. Documented by jsdoc-to-markdown.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].