<commit_before># uPython-esp8266-httpserver

This is a General Purpose http server for ESP8266 written in micropython (www.micropython.org)
It just serves static html files. Simply upload into flash any html files and she will serve them. 
As an example put your index.html with just "hello world!" in it and you have the K&R standard greetings.

It is highly configurable with parameters for SSID, PWD, AP SSID and many others. It is virually unlimited as the configuration parameters are kept into a json array of {'key', 'value'} and the server can simply store as many as possible.

It is mainly a temperature web server. For devices like ESP8266 and with temperature sensors based on DS18b20. 

*  the http server is general purpose and is easy to customize and configure
*  the Makefile is pretty powerful and automatize a lot of common tasks upload and reset using the script espsend.py 
which should be installed or configured in the proper directory
*  It uses other tools such as webrepl 


# Requirements

Software: based on micropython version 1.8.5. Probably latest and bleeding version works best.

    # git clone https://github.com/micropython/micropython.git

Hardware: Tested on Wemos D1 and Lolin V3 with ESP8266 chipset. For temperature a Dallas DS18b20 is needed wired to the device.


# DIFY (Do It Fu**ing Yourself)

Acutally I assemble all the stuff into a microappliance and I disseminate my places to track temperatures all around.
Look at the pictures. 


## BOM (Billing of Materials)

You can easily find all this stuff very cheap on aliexpress... just shop around ;)

* Wemos D1 mini (around 3$)
* Cheap Charger (< 1$)
* Micro USB Cable 5cm (< 1$)
* Sensor DS18b20 (< 1$)

Expect to afford 6US$ !!!
Isn't it fu**ing amazing?
![esp8266 temp sensor](https://www.dropbox.com/s/mw0tacnw87kg23v/IMG_0580.JPG?dl=0)

I suggest to solder the 3 wires of the DS18B20 sensor directly on the Wemos D1 pins: 5V-GND-D4 i
They are contiguous.

No resistor is needed then (but check the code for the right PIN which is PIN=2).

# USAGE
Server can be called with: http://192.168.1.123:8805/help 

Many other configurations are possible

For instance if you want to upload data to the cloud there is a asynchronous routine called 'register' that push into a server values with json format. The server that holds data can be found here:
    https://github.com/ernitron/temperature-server

## STATIC FILES
HTML files can be added/uploaded into FLASH memory of device and will be served.

For example if you upload your example.html file and request: http://192.168.1.123:8805/example.html

## DYNAMIC BEHAVIOR
Can be configured in the main loop to serve dynamically generated contents
Conventionally contents are kept in cb_xyz() in content.py
<commit_msg>update 2016-ott-29 15:39:18<commit_after># uPython-esp8266-httpserver

This is a General Purpose http server for ESP8266 written in micropython (www.micropython.org)
It just serves static html files. Simply upload into flash any html files and she will serve them. 
As an example put your index.html with just "hello world!" in it and you have the K&R standard greetings.

It is highly configurable with parameters for SSID, PWD, AP SSID and many others. It is virually unlimited as the configuration parameters are kept into a json array of {'key', 'value'} and the server can simply store as many as possible.

It is mainly a temperature web server. For devices like ESP8266 and with temperature sensors based on DS18b20. 

*  the http server is general purpose and is easy to customize and configure
*  the Makefile is pretty powerful and automatize a lot of common tasks upload and reset using the script espsend.py 
which should be installed or configured in the proper directory
*  It uses other tools such as webrepl 


# Requirements

Software: based on micropython version 1.8.5. Probably latest and bleeding version works best.

    # git clone https://github.com/micropython/micropython.git

Hardware: Tested on Wemos D1 and Lolin V3 with ESP8266 chipset. For temperature a Dallas DS18b20 is needed wired to the device.


# DIFY (Do It Fu**ing Yourself)

Acutally I assemble all the stuff into a microappliance and I disseminate my places to track temperatures all around.
Look at the pictures. 


## BOM (Billing of Materials)

You can easily find all this stuff very cheap on aliexpress... just shop around ;)

* Wemos D1 mini (around 3$)
* Cheap Charger (< 1$)
* Micro USB Cable 5cm (< 1$)
* Sensor DS18b20 (< 1$)

Expect to afford 6US$ !!!
Isn't it fu**ing amazing?  https://www.dropbox.com/s/mw0tacnw87kg23v/IMG_0580.JPG?dl=0

I suggest to solder the 3 wires of the DS18B20 sensor directly on the Wemos D1 pins: 5V-GND-D4 i
They are contiguous.

No resistor is needed then (but check the code for the right PIN which is PIN=2).

# USAGE
Server can be called with: http://192.168.1.123:8805/help 

Many other configurations are possible

For instance if you want to upload data to the cloud there is a asynchronous routine called 'register' that push into a server values with json format. The server that holds data can be found here:
    https://github.com/ernitron/temperature-server

## STATIC FILES
HTML files can be added/uploaded into FLASH memory of device and will be served.

For example if you upload your example.html file and request: http://192.168.1.123:8805/example.html

## DYNAMIC BEHAVIOR
Can be configured in the main loop to serve dynamically generated contents
Conventionally contents are kept in cb_xyz() in content.py

{'fraction_non_alphanumeric': 0.057758464602571065, 'fraction_numerical': 0.034401593336954556, 'mean_word_length': 4.143389199255121, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '549952', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1538, 'n_words': 816}