Archived
2

cleaned TODOS

This commit is contained in:
VLE2FE
2020-06-05 10:51:03 +02:00
parent ca29cef48c
commit 99be1798d0
7 changed files with 196 additions and 25 deletions

View File

@ -16,7 +16,7 @@ export default class api {
static setup () {
let apiDoc: JSONSchema = {};
jsonRefParser.bundle('api/api.yaml', (err, doc) => { // parse yaml
if(err) throw err;
if (err) throw err;
apiDoc = doc;
apiDoc.paths = apiDoc.paths.allOf.reduce((s, e) => Object.assign(s, e)); // bundle routes
apiDoc = this.resolveXDoc(apiDoc);

View File

@ -1,17 +1,12 @@
import express from 'express';
import bodyParser from 'body-parser';
import compression from 'compression';
import contentFilter from 'content-filter';
import mongoSanitize from 'mongo-sanitize';
import helmet from 'helmet';
import api from './api';
import db from './db';
// TODO: check executing index.js/move everything needed into dist
// TODO: validation: VZ, Humidity: min/max value, DPT: filename
// TODO: add multiple samples at once (only GUI)
// TODO: think about the display of deleted/new samples and validation in data and UI
// TODO: improve error coverage
// TODO: guess properties from material name in UI
// TODO: mongodb user
// tell if server is running in debug or production environment
console.info(process.env.NODE_ENV === 'production' ? '===== PRODUCTION =====' : process.env.NODE_ENV === 'test' ? '' :'===== DEVELOPMENT =====');
@ -28,8 +23,10 @@ app.disable('x-powered-by');
const port = process.env.PORT || 3000;
//middleware
app.use(helmet());
app.use(express.json({ limit: '5mb'}));
app.use(express.urlencoded({ extended: false, limit: '5mb' }));
app.use(compression()); // compress responses
app.use(bodyParser.json());
app.use(contentFilter()); // filter URL query attacks
app.use((req, res, next) => { // filter body query attacks

View File

@ -9,9 +9,7 @@ import mongoose from 'mongoose';
// TODO: generate output for ML in format DPT -> data, implement filtering, field selection
// TODO: generate csv
// TODO: filter by not completely filled/no measurements
// TODO: write script for data import
// TODO: allow adding sample numbers for existing samples
describe('/sample', () => {
let server;