Webserv's aim is to have a fast, simple way to provide a backend to your projects. We want to enable developers to start working on their experience immediately.
Serve a folder right now without installing anything using npx
.
npx webserv
Webserv comes with standard server patterns. Start a proxy, CRUD server, upload, or log connections from the command-line. Have a more complex use case? webserv
supports JSON configs and has a fully-typed programmatic API so you will never be stuck.
Want to learn more? Look at our examples and read through our documentation.
Webserv allows you to quickly start a fully fledged development server from the command line without editing a single file.
Create a http
or https
server (defaults to http)
webserv -m https
https servers will auto-generate self-signed certificates
Log all requests to the console
webserv -l
Set the port to use (defaults to 8888)
webserv -p 8000
Start a basic CRUD server
webserv -t crud
This server keeps records in an internal store.
- GET
/
will list all of the records - POST
/
with a json object in the body with anid
to add a record - PUT
/
with a json object in the body to update a record - GET
/id/:id
to view a single record - DELETE
/id/:id
to delete a record
Serve the directory.
This is the default server type. If the directory
is omitted the current directory will be served.
webserv -t file ./dist
Create a log server that logs all request to the console and returns 200.
webserv -t log
Create a proxy server.
webserv -t proxy http://devpaul.com
Create an upload server.
directory
is the location where uploaded files will be stored
webserv -t upload ./files
- GET
/
provides an interface to upload files - POST
/
uploads the file(s) - GET
/list
lists files that have been uploaded
Webserv supports more complex usage through config files. When a file named webserv.json
is present or when webserv
is launched using the -c <configPath>
option, webserv will launch using the provided configuration.
The available configurations match the server types (available with the -t
option): crud, file, log, proxy, and upload.
See the configuration documentation for all of the details.
For users that may need to create their own services or have complex use cases that are not served the configuration, webserv
offers a fully-typed programmatic API written in TypeScript. See the hello world example for example usage.