Skip to content
Snippets Groups Projects
Commit d477b075 authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

better structure

parent f1f801c5
Branches
Tags
1 merge request!3better structure
Pipeline #8279 failed
...@@ -4,4 +4,5 @@ export = Security; ...@@ -4,4 +4,5 @@ export = Security;
declare class Security { declare class Security {
constructor(); constructor();
setHeaders(req: express.Request, res: express.Response, next: express.NextFunctiont): void;
} }
module.exports = function(options) { module.exports = function(options = {}) {
return function(req, res, next) { let security = {}
if(!options) options = {} security.options = options
security.setHeaders = function(req, res, next) {
if(!this.options) options = {}
else options = this.options
if (typeof options.CacheControl === 'undefined') { if (typeof options.CacheControl === 'undefined') {
options.CacheControl = 'no-cache, no-store, must-revalidate' options.CacheControl = 'no-cache, no-store, must-revalidate'
...@@ -137,4 +141,6 @@ module.exports = function(options) { ...@@ -137,4 +141,6 @@ module.exports = function(options) {
next() next()
} }
return security;
} }
\ No newline at end of file
{ {
"name": "@libs/security", "name": "@libs/security",
"version": "2.2.3", "version": "2.3.0",
"description": "Sets Headers to a very save style in express-apps. may be overriden by config", "description": "Sets Headers to a very save style in express-apps. may be overriden by config",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment