Comparing version 7.0.0 to 7.0.1
@@ -1,2 +0,2 @@ | ||
# appa change log | ||
# appa-api change log | ||
@@ -3,0 +3,0 @@ All notable changes to this project will be documented in this file. |
@@ -1,2 +0,2 @@ | ||
## How to contribute to `appa` | ||
## Contributing to appa-api | ||
@@ -84,2 +84,2 @@ ### Prerequisites: | ||
are often contentious and we'd like to keep discussion brief, civil and focused | ||
on what we're actually doing, not wandering off into too much imaginary stuff. | ||
on what we're actually doing, not wandering off into too much imaginary stuff. |
@@ -22,3 +22,3 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
- `config.log` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** – Set to `false` to disable logging. Set to an object with options that are passed to [pino](https://npmjs.com/pino) and [pino-http](https://npmjs.com/pino-http) | ||
- `config.notFound` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** – Function that handlers 404 routes. Provides `req`, `res`, and `ctx` arguments just like other appa route handlers. Default: a function that sends a `404` statusCode with the message `Not found`. | ||
- `config.notFound` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** – Function that handlers 404 routes. Provides `req`, `res`, and `ctx` arguments just like other appa route handlers. Default: a function that sends a `404` statusCode with the JSON `{ message: 'Not found' }`. | ||
@@ -28,3 +28,3 @@ **Examples** | ||
```javascript | ||
var appa = require('appa') | ||
var appa = require('appa-api') | ||
@@ -34,3 +34,3 @@ var app = appa({ | ||
notFound: function (req, res, ctx) { | ||
return app.error(404, 'Not Found').pipe(res) | ||
return app.error(res, 404, 'Not Found') | ||
} | ||
@@ -56,3 +56,3 @@ }) | ||
var http = require('http') | ||
var appa = require('appa') | ||
var appa = require('appa-api') | ||
@@ -94,6 +94,6 @@ var app = appa() | ||
```javascript | ||
var send = require('appa/send') | ||
var send = require('appa-api/send') | ||
app.on('/', function (req, res, ctx) { | ||
send({ message: 'hi' }).pipe(res) | ||
send(res, { message: 'hi' }) | ||
}) | ||
@@ -115,6 +115,6 @@ ``` | ||
```javascript | ||
var error = require('appa/error') | ||
var error = require('appa-api/error') | ||
app.on('/', function (req, res, ctx) { | ||
error(404, 'Resource not found').pipe(res) | ||
error(res, 404, 'Resource not found') | ||
}) | ||
@@ -121,0 +121,0 @@ ``` |
@@ -1,1 +0,1 @@ | ||
# Getting started with appa | ||
# Getting started with appa-api |
@@ -1,1 +0,1 @@ | ||
# Using appa with related modules | ||
# Using appa-api with related modules |
@@ -7,3 +7,3 @@ var http = require('http') | ||
app.on('/', function (req, res, ctx) { | ||
send(200, { message: 'oh hey friends' }).pipe(res) | ||
send(res, 200, { message: 'oh hey friends' }) | ||
}) | ||
@@ -10,0 +10,0 @@ |
@@ -9,8 +9,8 @@ var http = require('http') | ||
if (req.method === 'POST') { | ||
return send(200, ctx.body).pipe(res) | ||
return send(res, 200, ctx.body) | ||
} else if (req.method === 'GET') { | ||
return send(200, { message: 'oh hey friends' }).pipe(res) | ||
return send(res, 200, { message: 'oh hey friends' }) | ||
} | ||
return error(400, 'Method not allowed').pipe(res) | ||
return error(res, 400, 'Method not allowed') | ||
}) | ||
@@ -17,0 +17,0 @@ |
{ | ||
"name": "appa-api", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "Quickly create simple HTTP services.", | ||
@@ -16,15 +16,15 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/sethvincent/appa-api .git" | ||
"url": "git+https://github.com/sethvincent/appa-api.git" | ||
}, | ||
"author": "", | ||
"author": "sethvincent", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/sethvincent/appa-api /issues" | ||
"url": "https://github.com/sethvincent/appa-api/issues" | ||
}, | ||
"homepage": "https://github.com/sethvincent/appa-api #readme", | ||
"homepage": "https://github.com/sethvincent/appa-api#readme", | ||
"dependencies": { | ||
"JSONStream": "^1.3.1", | ||
"fast-json-parse": "^1.0.2", | ||
"pino": "^4.5.0", | ||
"pino-http": "^2.6.0", | ||
"pino": "^4.5.2", | ||
"pino-http": "^2.6.1", | ||
"pump": "^1.0.2", | ||
@@ -35,7 +35,7 @@ "qs": "^6.4.0", | ||
"type-is": "^1.6.15", | ||
"wayfarer": "^6.5.3" | ||
"wayfarer": "^6.6.0" | ||
}, | ||
"devDependencies": { | ||
"dependency-check": "^2.8.0", | ||
"documentation": "^4.0.0-rc.0", | ||
"documentation": "^4.0.0-rc.1", | ||
"from2-string": "^1.1.0", | ||
@@ -42,0 +42,0 @@ "into-stream": "^3.1.0", |
@@ -38,3 +38,3 @@ # appa-api | ||
app.on('/', function (req, res, context) { | ||
send({ message: 'oh hey friends' }).pipe(res) | ||
send(res, { message: 'oh hey friends' }) | ||
}) | ||
@@ -57,3 +57,3 @@ | ||
module.exports = function (req, res, ctx) { | ||
return error(404, 'Not found').pipe(res) | ||
return error(res, 404, 'Not found') | ||
} | ||
@@ -70,3 +70,3 @@ ``` | ||
log.error(req.method, '500', errorStack) | ||
return error(500, 'Internal server error').pipe(res) | ||
return error(res, 500, 'Internal server error') | ||
} | ||
@@ -73,0 +73,0 @@ ``` |
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
0
60860
Updatedpino@^4.5.2
Updatedpino-http@^2.6.1
Updatedwayfarer@^6.6.0