Skip to content

Instantly share code, notes, and snippets.

@vital-edu
Last active June 17, 2020 16:53
Show Gist options
  • Save vital-edu/15c2fbcc3fb66aa8c3bb9a9f8019a84b to your computer and use it in GitHub Desktop.
Save vital-edu/15c2fbcc3fb66aa8c3bb9a9f8019a84b to your computer and use it in GitHub Desktop.
Ref
import verifyJwt from 'security';
import logger from 'logger';
import model from 'model';
function handlePostRequest(request) {
if (request.headers.authorization === null) {
throw Error('Unauthorized');
}
if (!verifyJwt(request.headers.authorization)) {
throw Error('Unauthorized');
}
// Handling post request
model.save(request.payload);
var logMessage = `POST - ${request.url} - ${new Date().toISOString}`;
var log = logger.createNewLogEntry();
log.add(logMessage);
log.save();
return 'OK';
}
function handleGetRequest(request) {
if (request.headers.authorization === null) {
throw Error('Unauthorized');
}
if (!verifyJwt(request.headers.authorization)) {
throw Error('Unauthorized');
}
// Handling post request
var list = model.fetch(request.payload);
var logMessage = `GET - ${request.url} - ${new Date().toISOString}`;
var log = logger.createNewLogEntry();
log.add(logMessage);
log.save();
return list;
}

Conceptual model

Conceptual diagram

Frontend prototype

Layout draft

@vital-edu
Copy link
Author

layout-draft
conceptual-data-diagram

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment