-3
\$\begingroup\$

Create your smallest web server in your preferred language!

Requirements

Must respond to atleast 1 type of request (get,post,patch,delete), with a specified string. Smallest implementation wins! *String can be empty

You may use any library you want

My personal record for this was 56B in node

require('express')().use((r,w)=>w.send('')).listen(8080)
\$\endgroup\$
  • 1
    \$\begingroup\$ I could return a 404 if you want \$\endgroup\$ – Jo King Jul 3 '19 at 5:47
  • \$\begingroup\$ Sure, anything that works \$\endgroup\$ – jsgang Jul 3 '19 at 5:53
  • 3
    \$\begingroup\$ Possible duplicate of 418: I'm a teapot \$\endgroup\$ – Sanchises Jul 3 '19 at 6:07
2
\$\begingroup\$

APL (Dyalog Unicode) with MiServer, 8 bytes

Start'.'

Starts a website on port 8080 serving the current directory.

This is what an interactive session transcript can look like:

      )xload miserver
.\miserver.dws saved Thu Apr  4 23:27:46 2019
      Start'.'
Virtual alias "PlugIns" overrides site path of same name.
MiServer for "." started on http://10.101.1.172:8080
Running in Debug mode (configured by setting <Production> in /Config/Server.xml)
\$\endgroup\$
2
\$\begingroup\$

Python 3 with -m http.server, 11 bytes

No code. Just run python.

Try it online!

\$\endgroup\$
  • 3
    \$\begingroup\$ Isn't that 0 bytes with a language of "Python 3 -m http.server"? \$\endgroup\$ – Expired Data Jul 3 '19 at 6:55
  • \$\begingroup\$ The inclusion of "http.server" on the command line accounts for the 11 bytes. \$\endgroup\$ – G B Jul 3 '19 at 8:14
  • 3
    \$\begingroup\$ Yeah but isnt that just equivalent to a compiler flag.. like -u in c# \$\endgroup\$ – Expired Data Jul 3 '19 at 8:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.