First commit - WIP WIP
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
8
.idea/Spritzschema.iml
generated
Normal file
8
.idea/Spritzschema.iml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
6
.idea/jsLibraryMappings.xml
generated
Normal file
6
.idea/jsLibraryMappings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptLibraryMappings">
|
||||||
|
<includedPredefinedLibrary name="Node.js Core" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/../Spritzschema/.idea/Spritzschema.iml" filepath="$PROJECT_DIR$/../Spritzschema/.idea/Spritzschema.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
19
.idea/php.xml
generated
Normal file
19
.idea/php.xml
generated
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MessDetectorOptionsConfiguration">
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PHPCSFixerOptionsConfiguration">
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||||
|
<option name="highlightLevel" value="WARNING" />
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PhpStanOptionsConfiguration">
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PsalmOptionsConfiguration">
|
||||||
|
<option name="transferred" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
11
.idea/runConfigurations/bin_www.xml
generated
Normal file
11
.idea/runConfigurations/bin_www.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="bin/www" type="NodeJSConfigurationType" path-to-js-file="$PROJECT_DIR$/../Spritzschema/bin/www" working-dir="$PROJECT_DIR$/../Spritzschema">
|
||||||
|
<envs>
|
||||||
|
<env name="DEBUG" value="untitled:*" />
|
||||||
|
</envs>
|
||||||
|
<EXTENSION ID="com.jetbrains.nodejs.run.NodeStartBrowserRunConfigurationExtension">
|
||||||
|
<browser url="http://localhost:3000/" />
|
||||||
|
</EXTENSION>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
19
Dockerfile_tabletten
Normal file
19
Dockerfile_tabletten
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
FROM node:9-alpine
|
||||||
|
|
||||||
|
ADD package.json /tmp
|
||||||
|
RUN cd /tmp && npm install
|
||||||
|
RUN mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/
|
||||||
|
|
||||||
|
WORKDIR /opt/app
|
||||||
|
ADD . /opt/app
|
||||||
|
|
||||||
|
RUN apk add --no-cache tzdata
|
||||||
|
ENV TZ Europe/Berlin
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
RUN touch cmds.sh \
|
||||||
|
&& echo 'npm start' >>cmds.sh
|
||||||
|
|
||||||
|
EXPOSE 3014
|
||||||
|
|
||||||
|
CMD sh ./cmds.sh
|
||||||
42
app.js
Normal file
42
app.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
var createError = require('http-errors');
|
||||||
|
var express = require('express');
|
||||||
|
var path = require('path');
|
||||||
|
var cookieParser = require('cookie-parser');
|
||||||
|
var logger = require('morgan');
|
||||||
|
|
||||||
|
var indexRouter = require('./routes/index');
|
||||||
|
var usersRouter = require('./routes/users');
|
||||||
|
|
||||||
|
var app = express();
|
||||||
|
|
||||||
|
// view engine setup
|
||||||
|
app.set('views', path.join(__dirname, 'views'));
|
||||||
|
app.set('view engine', 'pug');
|
||||||
|
|
||||||
|
app.use(logger('dev'));
|
||||||
|
app.use(express.json());
|
||||||
|
app.use(express.urlencoded({ extended: false }));
|
||||||
|
app.use(cookieParser());
|
||||||
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
||||||
|
app.use('/', indexRouter);
|
||||||
|
app.use('/data', indexRouter);
|
||||||
|
app.use('/users', usersRouter);
|
||||||
|
|
||||||
|
// catch 404 and forward to error handler
|
||||||
|
app.use(function(req, res, next) {
|
||||||
|
next(createError(404));
|
||||||
|
});
|
||||||
|
|
||||||
|
// error handler
|
||||||
|
app.use(function(err, req, res, next) {
|
||||||
|
// set locals, only providing error in development
|
||||||
|
res.locals.message = err.message;
|
||||||
|
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
||||||
|
|
||||||
|
// render the error page
|
||||||
|
res.status(err.status || 500);
|
||||||
|
res.render('error');
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = app;
|
||||||
90
bin/www
Executable file
90
bin/www
Executable file
@@ -0,0 +1,90 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var app = require('../app');
|
||||||
|
var debug = require('debug')('Spritzschema:server');
|
||||||
|
var http = require('http');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get port from environment and store in Express.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var port = normalizePort(process.env.PORT || '3100');
|
||||||
|
app.set('port', port);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create HTTP server.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var server = http.createServer(app);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen on provided port, on all network interfaces.
|
||||||
|
*/
|
||||||
|
|
||||||
|
server.listen(port);
|
||||||
|
server.on('error', onError);
|
||||||
|
server.on('listening', onListening);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a port into a number, string, or false.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function normalizePort(val) {
|
||||||
|
var port = parseInt(val, 10);
|
||||||
|
|
||||||
|
if (isNaN(port)) {
|
||||||
|
// named pipe
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (port >= 0) {
|
||||||
|
// port number
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event listener for HTTP server "error" event.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onError(error) {
|
||||||
|
if (error.syscall !== 'listen') {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bind = typeof port === 'string'
|
||||||
|
? 'Pipe ' + port
|
||||||
|
: 'Port ' + port;
|
||||||
|
|
||||||
|
// handle specific listen errors with friendly messages
|
||||||
|
switch (error.code) {
|
||||||
|
case 'EACCES':
|
||||||
|
console.error(bind + ' requires elevated privileges');
|
||||||
|
process.exit(1);
|
||||||
|
break;
|
||||||
|
case 'EADDRINUSE':
|
||||||
|
console.error(bind + ' is already in use');
|
||||||
|
process.exit(1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event listener for HTTP server "listening" event.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onListening() {
|
||||||
|
var addr = server.address();
|
||||||
|
var bind = typeof addr === 'string'
|
||||||
|
? 'pipe ' + addr
|
||||||
|
: 'port ' + addr.port;
|
||||||
|
debug('Listening on ' + bind);
|
||||||
|
}
|
||||||
63
build_and_copy.sh
Normal file
63
build_and_copy.sh
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Build Docker-Container
|
||||||
|
#
|
||||||
|
# Call: buildit.sh name [target]
|
||||||
|
#
|
||||||
|
# The Dockerfile must be named like Dockerfile_name
|
||||||
|
#
|
||||||
|
# 2018-09-20 rxf
|
||||||
|
# - before sending docker image to remote, tag actual remote image
|
||||||
|
#
|
||||||
|
# 2018-09-14 rxf
|
||||||
|
# - first Version
|
||||||
|
#
|
||||||
|
|
||||||
|
set -x
|
||||||
|
port=""
|
||||||
|
orgName=sensorapi
|
||||||
|
name=sensorapi
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "Usage build_and_copy.sh [-p port] [-n name] target"
|
||||||
|
echo " Build docker container $name and copy to target"
|
||||||
|
echo "Params:"
|
||||||
|
echo " target: Where to copy the container to "
|
||||||
|
echo " -p port: ssh port (default 22)"
|
||||||
|
echo " -n name: new name for container (default: $orgName)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts n:p:h? o
|
||||||
|
do
|
||||||
|
case "$o" in
|
||||||
|
n) name="$OPTARG";;
|
||||||
|
p) port="-p $OPTARG";;
|
||||||
|
h) usage; exit 0;;
|
||||||
|
*) usage; exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
if [[ -z "$target" ]]; then
|
||||||
|
target=$1
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo "bad option $1"
|
||||||
|
# exit 1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
docker build -f Dockerfile_$orgName -t $name .
|
||||||
|
|
||||||
|
dat=`date +%Y%m%d%H%M`
|
||||||
|
|
||||||
|
if [ "$target" == "localhost" ]
|
||||||
|
then
|
||||||
|
docker tag $name $name:V_$dat
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
ssh $port $target "docker tag $name $name:V_$dat"
|
||||||
|
docker save $name | bzip2 | pv | ssh $port $target 'bunzip2 | docker load'
|
||||||
17
docker-compose.yml
Normal file
17
docker-compose.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
version: '3.9'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mongodata:
|
||||||
|
|
||||||
|
services:
|
||||||
|
mongodb:
|
||||||
|
image: mongo
|
||||||
|
volumes:
|
||||||
|
- mongodata:/data/db
|
||||||
|
- ${PWD}/log:/var/log
|
||||||
|
ports:
|
||||||
|
- "27017:27017"
|
||||||
|
container_name: mongodb
|
||||||
|
# command: '--auth'
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
81
modules/mongointerface.js
Normal file
81
modules/mongointerface.js
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
// all functions to get data from mongodb
|
||||||
|
|
||||||
|
const {MongoClient} = require('mongodb')
|
||||||
|
|
||||||
|
const MONGOHOST = process.env.MONGOHOST || 'localhost'
|
||||||
|
const MONGOPORT = process.env.MONGOPORT || 27017
|
||||||
|
const MONGOAUTH = (process.env.MONGOAUTH === "true") || false
|
||||||
|
const MONGOUSRP = process.env.MONGOUSRP || ""
|
||||||
|
const MONGOBASE = process.env.MONGOBASE || 'medizin'
|
||||||
|
|
||||||
|
const MONGO_URL = MONGOAUTH ? 'mongodb://'+MONGOUSRP+'@' + MONGOHOST + ':' + MONGOPORT + '/?authSource=admin' : 'mongodb://'+MONGOHOST+':'+MONGOPORT // URL to mongo database
|
||||||
|
const COLLECTION = 'spritzschema'
|
||||||
|
|
||||||
|
const doMongo = async function(cmd, options) {
|
||||||
|
let erg = {err: null}
|
||||||
|
const client = new MongoClient(MONGO_URL, { useUnifiedTopology: true })
|
||||||
|
try {
|
||||||
|
await client.connect()
|
||||||
|
if (cmd === 'getdata') {
|
||||||
|
erg = await getAPIdataOne(client, options)
|
||||||
|
} else if (cmd === 'putdata') {
|
||||||
|
erg = await putAPIdataOne(client, options)
|
||||||
|
} else if (cmd === 'deldata') {
|
||||||
|
erg = await delAPIdataOne(client, options)
|
||||||
|
} else {
|
||||||
|
erg.err = "Unknown Call"
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
erg.err = e
|
||||||
|
} finally {
|
||||||
|
await client.close()
|
||||||
|
}
|
||||||
|
return erg
|
||||||
|
}
|
||||||
|
|
||||||
|
// *********************************************
|
||||||
|
// Get data direct via API
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return:
|
||||||
|
// JSON Dokument mit den angefragten Werten
|
||||||
|
// *********************************************
|
||||||
|
async function getAPIdataOne(client, options) {
|
||||||
|
let erg = {err: null}
|
||||||
|
try {
|
||||||
|
erg.data = await client.db(MONGOBASE).collection(COLLECTION).findOne({curdata: options.curdata},{ projection:{_id: 0} })
|
||||||
|
} catch
|
||||||
|
(e) {
|
||||||
|
console.error(e)
|
||||||
|
erg.err = e
|
||||||
|
}
|
||||||
|
return erg
|
||||||
|
}
|
||||||
|
|
||||||
|
async function putAPIdataOne(client, options) {
|
||||||
|
let erg = {err: null}
|
||||||
|
const query = {curdate: options.data.curdate}
|
||||||
|
const opts = {upsert : true}
|
||||||
|
const update = {$set: options.data}
|
||||||
|
try {
|
||||||
|
erg.date = await client.db(MONGOBASE).collection(COLLECTION).updateOne(query, update, opts)
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
erg.err = e
|
||||||
|
}
|
||||||
|
return erg
|
||||||
|
}
|
||||||
|
|
||||||
|
async function delAPIdataOne(client, options) {
|
||||||
|
let erg = {err: null}
|
||||||
|
const query = {curdate: options.curdate}
|
||||||
|
try {
|
||||||
|
erg.data = await client.db(MONGOBASE).collection(COLLECTION).deleteOne(query)
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
erg.err = e
|
||||||
|
}
|
||||||
|
return erg
|
||||||
|
}
|
||||||
|
exports.doMongo = doMongo
|
||||||
1616
package-lock.json
generated
Normal file
1616
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
package.json
Normal file
17
package.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "untitled",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"start": "node ./bin/www"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"cookie-parser": "~1.4.4",
|
||||||
|
"debug": "~2.6.9",
|
||||||
|
"express": "^4.18.2",
|
||||||
|
"http-errors": "~1.6.3",
|
||||||
|
"mongodb": "^5.1.0",
|
||||||
|
"morgan": "~1.9.1",
|
||||||
|
"pug": "^2.0.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
70
public/javascripts/script.js
Normal file
70
public/javascripts/script.js
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', async function () {
|
||||||
|
const DateTime = luxon.DateTime;
|
||||||
|
const filename = 'data/data.json'
|
||||||
|
let curdate = ''
|
||||||
|
|
||||||
|
const dt = DateTime.now()
|
||||||
|
const dt1 = dt.plus({month:1})
|
||||||
|
curdate = `${dt.toFormat('LLLL')}/${dt1.toFormat('LLLL y')}`
|
||||||
|
document.querySelector('#curmon').innerHTML = curdate
|
||||||
|
|
||||||
|
let ret = await getData(filename)
|
||||||
|
fillSchema(ret.data)
|
||||||
|
|
||||||
|
document.querySelector('#sptab').addEventListener('click', markField);
|
||||||
|
|
||||||
|
function markField (e) {
|
||||||
|
let field = e.target;
|
||||||
|
field.setAttribute('aria-label','x');
|
||||||
|
field.setAttribute('disabled','disabled');
|
||||||
|
let lastDate = parseInt(field.innerHTML)
|
||||||
|
let month = curdate.split('/')[0]
|
||||||
|
let data = {curdate: curdate.slice(0, -5), last: lastDate}
|
||||||
|
let setArray = []
|
||||||
|
let fields = document.querySelectorAll('#sptab button')
|
||||||
|
for (i = 0; i < fields.length; i++) {
|
||||||
|
setArray[i] = 0
|
||||||
|
if (fields[i].hasAttribute('disabled')) {
|
||||||
|
setArray[i] = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.data = setArray
|
||||||
|
storeData(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillSchema(data) {
|
||||||
|
const setArray = data.data
|
||||||
|
let lastday = DateTime.now().endOf('month').day
|
||||||
|
let first = lastday === data.last ? 1 : data.last+1
|
||||||
|
for(let i = 1, k = first; i <= 35; i++, k++) {
|
||||||
|
if(k > lastday) {
|
||||||
|
k = 1
|
||||||
|
}
|
||||||
|
if (i === 18) {
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
let sel = '#bt'+i
|
||||||
|
document.querySelector(sel).innerHTML = k
|
||||||
|
if(setArray[i-1] === 1) {
|
||||||
|
document.querySelector(sel).setAttribute('aria-label', 'x')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getData() {
|
||||||
|
let erg = await fetch('data')
|
||||||
|
return erg.json()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function storeData(data) {
|
||||||
|
const response = await fetch('/data', {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
headers: {
|
||||||
|
'Content-Type':"application/json"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return response.json()
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
43
public/stylesheets/style.css
Normal file
43
public/stylesheets/style.css
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
body {
|
||||||
|
padding: 30px;
|
||||||
|
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #00B7FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spritztab #sptab {
|
||||||
|
width: 70vmin;
|
||||||
|
height: 50vmin;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(7, 1fr);
|
||||||
|
gap: 0;
|
||||||
|
margin: 30px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spritztab h1 {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spritztab h2 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spritztab button {
|
||||||
|
width: 10vmin;
|
||||||
|
height: 10vmin;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid black;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 200%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spritztab [aria-label="o"] {
|
||||||
|
background-image: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201%201%22%3E%3Ccircle%20cx%3D%220.5%22%20cy%3D%220.5%22%20r%3D%220.4%22%20fill%3D%22none%22%20stroke-width%3D%220.1%22%20stroke%3D%22blue%22%2F%3E%3C%2Fsvg%3E');
|
||||||
|
}
|
||||||
|
|
||||||
|
.spritztab [aria-label="x"] {
|
||||||
|
background-image: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201%201%22%3E%3Cline%20x1%3D%220.1%22%20y1%3D%220.1%22%20x2%3D%220.9%22%20y2%3D%220.9%22%20stroke-width%3D%220.1%22%20stroke%3D%22red%22%2F%3E%3Cline%20x1%3D%220.1%22%20y1%3D%220.9%22%20x2%3D%220.9%22%20y2%3D%220.1%22%20stroke-width%3D%220.1%22%20stroke%3D%22red%22%2F%3E%3C%2Fsvg%3E');
|
||||||
|
}
|
||||||
24
routes/index.js
Normal file
24
routes/index.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
const domongo = require('../modules/mongointerface')
|
||||||
|
|
||||||
|
/* GET home page. */
|
||||||
|
router.get('/', function(req, res, next) {
|
||||||
|
res.render('index', { title: 'Express' });
|
||||||
|
})
|
||||||
|
|
||||||
|
router.get('/data', async function(req, res, next) {
|
||||||
|
const options = {}
|
||||||
|
options.curdate = req.query.curdate
|
||||||
|
let erg = await domongo.doMongo('getdata', options)
|
||||||
|
res.json(erg)
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/data', async function (req, res, next) {
|
||||||
|
const options = {}
|
||||||
|
options.data = req.body
|
||||||
|
let erg = await domongo.doMongo('putdata', options)
|
||||||
|
res.json(erg)
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
9
routes/users.js
Normal file
9
routes/users.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
var express = require('express');
|
||||||
|
var router = express.Router();
|
||||||
|
|
||||||
|
/* GET users listing. */
|
||||||
|
router.get('/', function(req, res, next) {
|
||||||
|
res.send('respond with a resource');
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
6
views/error.pug
Normal file
6
views/error.pug
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
extends layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
h1= message
|
||||||
|
h2= error.status
|
||||||
|
pre #{error.stack}
|
||||||
46
views/index.pug
Normal file
46
views/index.pug
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
extends layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
.spritztab
|
||||||
|
h1 Spritz-Tabelle
|
||||||
|
h2#curmon
|
||||||
|
#sptab
|
||||||
|
button#bt1
|
||||||
|
button#bt2
|
||||||
|
button#bt3
|
||||||
|
button#bt4
|
||||||
|
button#bt5
|
||||||
|
button#bt6
|
||||||
|
button#bt7
|
||||||
|
|
||||||
|
button#bt8
|
||||||
|
button#bt9
|
||||||
|
button#bt10
|
||||||
|
button#bt11
|
||||||
|
button#bt12
|
||||||
|
button#bt13
|
||||||
|
button#bt14
|
||||||
|
|
||||||
|
button#bt15
|
||||||
|
button#bt16
|
||||||
|
button#bt17
|
||||||
|
button#bt18(aria-label="o" disabled)
|
||||||
|
button#bt19
|
||||||
|
button#bt20
|
||||||
|
button#bt21
|
||||||
|
|
||||||
|
button#bt22
|
||||||
|
button#bt23
|
||||||
|
button#bt24
|
||||||
|
button#bt25
|
||||||
|
button#bt26
|
||||||
|
button#bt27
|
||||||
|
button#bt28
|
||||||
|
|
||||||
|
button#bt29
|
||||||
|
button#bt30
|
||||||
|
button#bt31
|
||||||
|
button#bt32
|
||||||
|
button#bt33
|
||||||
|
button#bt34
|
||||||
|
button#bt35
|
||||||
10
views/layout.pug
Normal file
10
views/layout.pug
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
doctype html
|
||||||
|
html
|
||||||
|
head
|
||||||
|
title= 'Spritzschema'
|
||||||
|
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||||
|
script(src="https://cdn.jsdelivr.net/npm/luxon@3.3.0/build/global/luxon.min.js")
|
||||||
|
script(src="/javascripts/script.js")
|
||||||
|
|
||||||
|
body
|
||||||
|
block content
|
||||||
Reference in New Issue
Block a user