parent
ebfbc1144c
commit
f64935eb1d
19 changed files with 5050 additions and 0 deletions
76
examples/http_server/fsdata/fs/index.ssi
Normal file
76
examples/http_server/fsdata/fs/index.ssi
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/siimple.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||
<link rel="shortcut icon" href="img/favicon.png">
|
||||
|
||||
<title>HTTP Server</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul class="navbar">
|
||||
<li><a class="active" href="/">Home</a></li>
|
||||
<li><a href="about">About</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="grid main">
|
||||
<h1>ESP8266 HTTP Server</h1>
|
||||
|
||||
<div class="alert alert-done">HTTP Server is up and running.</div>
|
||||
|
||||
<p>This is an example HTTP server with CGI and SSI support. The switch below will allow you to test CGI handler and turn
|
||||
the blue LED on or off.</p>
|
||||
|
||||
<div class="cover" align="center">
|
||||
<div class="onoffswitch">
|
||||
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="led-switch" onclick="gpio();">
|
||||
<label class="onoffswitch-label" for="led-switch">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1>Server Status</h1>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td><b>Uptime:</b></td>
|
||||
<td><!--#uptime--> seconds</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Free heap:</b></td>
|
||||
<td><!--#heap--> bytes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>LED state:</b></td>
|
||||
<td id="ledState"><!--#led--></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h1>How it works</h1>
|
||||
<p> Each time the server detects a tag of the form <code><!--#name--></code> in a .shtml, .ssi or .shtm file
|
||||
where <code>name</code> appears as one of the tags supplied to <code>http_set_ssi_handler</code> in the <code>pcConfigSSITags</code> array,
|
||||
an insert string is appended after the tag string in file and sent back to the client.</p>
|
||||
<p>A CGI handler function is called each time the server is asked for a file
|
||||
whose name was previously registered as a CGI function using a call to <code>http_set_cgi_handler</code>.
|
||||
This function allows you to access the parameters provided along with the URI.</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.onload = function () {
|
||||
var ls = document.getElementById('ledState').innerHTML;
|
||||
ls = ls.split(/-->/).pop().trim();
|
||||
document.getElementById('led-switch').checked = (ls == 'On');
|
||||
};
|
||||
function gpio() {
|
||||
if (document.getElementById('led-switch').checked)
|
||||
window.location.href = 'gpio?off=2';
|
||||
else
|
||||
window.location.href = 'gpio?on=2';
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue