arrow-express
Advanced tools
Comparing version 0.2.3 to 0.2.5
@@ -8,2 +8,4 @@ { | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:coverage": "jest --coverage", | ||
"lint": "./node_modules/.bin/eslint .", | ||
@@ -26,2 +28,3 @@ "start:dev": "ts-node-dev --poll --respawn src/index.ts" | ||
"@types/express": "^4.17.11", | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^14.14.21", | ||
@@ -31,2 +34,4 @@ "@typescript-eslint/eslint-plugin": "^4.13.0", | ||
"eslint": "^7.18.0", | ||
"jest": "^26.6.3", | ||
"ts-jest": "^26.4.4", | ||
"ts-node": "^9.1.1", | ||
@@ -33,0 +38,0 @@ "ts-node-dev": "^1.1.1", |
@@ -6,3 +6,2 @@ # This is example application | ||
# You can copy this folder as boilerplate for | ||
# Default settings | ||
@@ -16,2 +15,4 @@ - Command to run app: | ||
- To authorize setup header: | ||
- `Authorize: Bearer token` | ||
- `Authorize: Bearer token` | ||
### You can copy this folder as boilerplate for your application |
@@ -7,2 +7,3 @@ import {RequestError} from "arrow-express"; | ||
} | ||
/** | ||
@@ -13,5 +14,4 @@ * Stub authorization guard | ||
const authHeader = req.headers.authorization; | ||
try { | ||
// Here place your token authorization | ||
const token = (authHeader as string).split(' ')[1]; | ||
const token = parseToken(authHeader); | ||
// Here place your token authorization | ||
if (token === 'token') | ||
@@ -22,6 +22,8 @@ return { | ||
else | ||
throw new Error(); | ||
} catch (_) { | ||
throw new RequestError(401); | ||
} | ||
}; | ||
throw new RequestError(401); | ||
}; | ||
function parseToken(authHeader: string) { | ||
return (authHeader as string).split(' ')[1]; | ||
} |
{ | ||
"name": "arrow-express", | ||
"version": "0.2.3", | ||
"version": "0.2.5", | ||
"description": "Library to bootstrap express applications with zero configuration", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1196507
41
31465