Mark van Renswoude
f87a8b6eb7
Implemented access point, station mode and basic web configuration page Actual lighting control is completely broken
60 lines
1.1 KiB
JavaScript
60 lines
1.1 KiB
JavaScript
/*
|
|
* Stairs
|
|
* Copyright 2017 (c) Mark van Renswoude
|
|
*
|
|
* https://git.x2software.net/pub/Stairs
|
|
*/
|
|
const express = require('express');
|
|
const app = express();
|
|
|
|
app.use(express.static('web'));
|
|
app.use(express.static('web/dist'));
|
|
|
|
app.get('/api/version', function(req, res)
|
|
{
|
|
res.send({
|
|
systemID: 'dev-server',
|
|
version: 'dev-server'
|
|
});
|
|
});
|
|
|
|
app.get('/api/connection', function(req, res)
|
|
{
|
|
res.send({
|
|
hostname: 'dev-server',
|
|
accesspoint: true,
|
|
station: true,
|
|
ssid: 'MyWiFiSSID',
|
|
password: 'supersecret',
|
|
dhcp: true,
|
|
ip: '192.168.1.234',
|
|
subnetmask: '255.255.255.0',
|
|
gateway: '192.168.1.0'
|
|
});
|
|
});
|
|
|
|
app.get('/api/connection/status', function(req, res)
|
|
{
|
|
res.send({
|
|
"ap": {
|
|
"enabled": true,
|
|
"ip": "192.168.4.1"
|
|
},
|
|
"station": {
|
|
"enabled": true,
|
|
"status": 1,
|
|
"ip": "0.0.0.0"
|
|
}
|
|
});
|
|
});
|
|
|
|
app.post('/api/connection', function(req, res)
|
|
{
|
|
res.sendStatus(200);
|
|
});
|
|
|
|
app.listen(3000, function()
|
|
{
|
|
console.log('Development server listening on port 3000')
|
|
console.log('Press Ctrl-C to stop')
|
|
}); |