Updates
This commit is contained in:
parent
f07b5d8760
commit
d23cafba97
33
README.md
33
README.md
@ -4,19 +4,36 @@ A (very) simple web server written in Lua for the ESP8266 firmware NodeMCU.
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
* **GET**
|
* **GET**
|
||||||
|
* **Multiple MIME types**
|
||||||
|
* **Error pages (404 and others)**
|
||||||
|
|
||||||
Simple GET method will return the requested file.
|
## How to use
|
||||||
NodeMCU's filesystem does not support folders, but filenames *can* contain slashes.
|
|
||||||
So prefix your server files with "http/" (yeah, weird).
|
|
||||||
|
|
||||||
__Example:__ Say the IP for your ESP8266 is 2.2.2.2 and the server is running in the default port 80.
|
1. Upload httpserver.lua using [luatool.py](https://github.com/4refr0nt/luatool) or equivalent.
|
||||||
Go to http://2.2.2.2/index.html using your web browser. The ESP8266 will serve you with the contents
|
Add the following to your init.lua in order to start the server:
|
||||||
of the file "http_index.html" (if it exists).
|
|
||||||
|
require("httpserver")
|
||||||
|
server = httpserver.start(80, 10)
|
||||||
|
|
||||||
|
80 is the port your server is listening to, and 10 is the timeout (in seconds) for clients.
|
||||||
|
|
||||||
|
2. Upload the files you want to serve.
|
||||||
|
Again, use luatool.py or similar and upload the HTML and other files.
|
||||||
|
|
||||||
|
All the files you upload must be prefixed with "http/". Wait, what?
|
||||||
|
|
||||||
|
Yes: NodeMCU's filesystem does not support folders, but filenames *can* contain slashes.
|
||||||
|
|
||||||
|
3. Visit your server from a web browser.
|
||||||
|
|
||||||
|
__Example:__ Say the IP for your ESP8266 is 2.2.2.2 and the server is
|
||||||
|
running in the default port 80. Go to http://2.2.2.2/index.html using your web browser. The ESP8266 will serve you with the contents
|
||||||
|
of the file "http/myPage.html" (if it exists). If you visit the root (/)
|
||||||
|
then index.html is server. By the way, the URLs are case-sensitive.
|
||||||
|
|
||||||
## Not supported
|
## Not supported
|
||||||
|
|
||||||
* Other methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
|
* Other methods: HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
|
||||||
* Serving anything that's not HTML (different mime types)
|
|
||||||
* Server side scripting.
|
* Server side scripting.
|
||||||
|
|
||||||
## Open issues
|
## Open issues
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user