Socket
Socket
Sign inDemoInstall

arrow-express

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arrow-express - npm Package Compare versions

Comparing version 0.2.3 to 0.2.5

example/src/api/guards/authorize.guard.spec.ts

5

example/package.json

@@ -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",

5

example/README.md

@@ -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

18

example/src/api/guards/authorize.guard.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc