express-result
Advanced tools
+12
-8
| { | ||
| "name": "express-result", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "Results for express.js", | ||
@@ -14,18 +14,22 @@ "license": "MIT", | ||
| "scripts": { | ||
| "docs": "verb", | ||
| "lint": "yarn lint:src && yarn lint:test", | ||
| "lint:fix": "yarn lint:src:fix && yarn lint:test:fix", | ||
| "docs": "docker run --rm -v ${PWD}:/opt/verb stefanwalther/verb", | ||
| "lint": "npm run lint:src && npm run lint:test", | ||
| "lint:fix": "npm run lint:src:fix && npm run lint:test:fix", | ||
| "lint:src": "eslint src", | ||
| "lint:src:fix": "eslint src --fix", | ||
| "lint:test": "eslint test", | ||
| "lint:test:fix": "eslint test --fix" | ||
| "lint:test:fix": "eslint test --fix", | ||
| "precommit": "npm run lint" | ||
| }, | ||
| "dependencies": { | ||
| "eslint-config-space-single": "^0.0.4", | ||
| "express": "^4.14.1", | ||
| "http-status-codes": "^1.1.6" | ||
| "http-status-codes": "^1.3.0" | ||
| }, | ||
| "devDependencies": { | ||
| "eslint": "^3.15.0" | ||
| "chai": "^4.1.2", | ||
| "eslint": "^3.19.0", | ||
| "eslint-config-space-single": "0.0.4", | ||
| "husky": "^0.14.3", | ||
| "mocha": "^5.0.5" | ||
| } | ||
| } |
+1
-6
@@ -6,3 +6,3 @@ # express-result | ||
| ## Install | ||
| Install using [npm]() | ||
| Install using [npm](https://npmjs.org) | ||
| ```sh | ||
@@ -12,7 +12,2 @@ $ npm install express-result --save | ||
| Install using [yarn]() | ||
| ```sh | ||
| $ yarn add express-result | ||
| ``` | ||
| ## Author | ||
@@ -19,0 +14,0 @@ **Stefan Walther** |
+33
-5
@@ -6,18 +6,46 @@ const HttpStatus = require('http-status-codes'); | ||
| /** | ||
| * | ||
| * @param res | ||
| * @param result | ||
| * | ||
| * @static | ||
| */ | ||
| static ok(res, result) { | ||
| res.status(HttpStatus.OK).json(result); | ||
| return res.status(HttpStatus.OK).json(result); | ||
| } | ||
| /** | ||
| * | ||
| * @param res | ||
| * @param result | ||
| * | ||
| * @static | ||
| */ | ||
| static created(res, result) { | ||
| res.status(HttpStatus.CREATED).json(result); | ||
| return res.status(HttpStatus.CREATED).json(result); | ||
| } | ||
| /** | ||
| * | ||
| * @param res | ||
| * @param err | ||
| * | ||
| * @static | ||
| */ | ||
| static error(res, err) { | ||
| res.setHeader('Content-Type', 'application/json'); | ||
| res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(err); | ||
| return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(err); | ||
| } | ||
| /** | ||
| * | ||
| * @param res | ||
| * @param json | ||
| * | ||
| * @static | ||
| */ | ||
| static json(res, json) { | ||
| res.setHeader('Content-Type', 'application/json'); | ||
| res.status(HttpStatus.OK).json(json); | ||
| return res.status(HttpStatus.OK).json(json); | ||
| } | ||
@@ -27,3 +55,3 @@ | ||
| res.setHeader('Content-Type', 'application/json'); | ||
| res.status(HttpStatus.UNAUTHORIZED).json(json); | ||
| return res.status(HttpStatus.UNAUTHORIZED).json(json); | ||
@@ -30,0 +58,0 @@ } |
| class ValidationError { | ||
| // class ValidationError { | ||
| // constructor(o) { | ||
| // Object.assign(this, o); | ||
| // } | ||
| // } | ||
| } | ||
| class ValidationErrors { | ||
@@ -16,4 +18,8 @@ constructor() { | ||
| // Todo: remove | ||
| // Todo: find | ||
| } | ||
| module.exports = ValidationErrors; |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
2779
23.62%2
-33.33%70
89.19%5
400%20
-20%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated