Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appa

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appa - npm Package Compare versions

Comparing version 3.0.2 to 4.0.0

0

CONTRIBUTING.md

@@ -0,0 +0,0 @@ ## How to contribute to `appa`

@@ -0,0 +0,0 @@ var http = require('http')

10

index.js

@@ -31,3 +31,3 @@ var qs = require('qs')

if (router.match(req, res)) return
else sendError(res, 404, 'Not Found')
else error(res, 404, 'Not Found')
}

@@ -48,3 +48,3 @@

if (options.log) log.error('Bad Request, invalid JSON', err)
return sendError(res, 400, 'Bad Request, invalid JSON')
return error(res, 400, 'Bad Request, invalid JSON')
}

@@ -89,3 +89,3 @@

*/
function sendError (res, statusCode, message) {
function error (res, statusCode, message) {
if (typeof statusCode === 'object') {

@@ -96,3 +96,3 @@ message = statusCode

if (options.log) log.info('sendError', statusCode, message)
if (options.log) log.info('error', statusCode, message)
return send(res, statusCode, { statusCode: statusCode, message: message })

@@ -104,5 +104,5 @@ }

app.send = send
app.error = sendError
app.error = error
app.router = router
return app
}

@@ -0,0 +0,0 @@ The MIT License (MIT)

{
"name": "appa",
"version": "3.0.2",
"version": "4.0.0",
"description": "Quickly build micro services.",

@@ -8,3 +8,3 @@ "main": "index.js",

"test": "standard && tape test.js | tap-spec",
"build:docs": "documentation-readme -s 'API'"
"build:docs": "documentation readme -s API"
},

@@ -25,2 +25,3 @@ "repository": {

"bole": "^2.0.0",
"documentation": "github:documentationjs/documentation",
"match-routes": "^2.0.0",

@@ -32,2 +33,3 @@ "qs": "^6.1.0",

"devDependencies": {
"documentation": "github:documentationjs/documentation",
"documentation-readme": "^2.1.1",

@@ -34,0 +36,0 @@ "minidocs": "github:freeman-lab/minidocs",

@@ -31,20 +31,20 @@ # appa

### app
### createApp
The request, response handler that is passed to `http.createServer`, and that
provides methods for your app.
Create the application. Returns the `app` function that can be passed into `http.createServer`.
**Parameters**
- `req` **Object** – the http request object
- `res` **Object** – the http response object
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `options.log` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** – whether appa should log using bole. default: true
### createApp
### app
Create the application. Returns the `app` function that can be passed into `http.createServer`.
The request, response handler that is passed to `http.createServer`, and that
provides methods for your app.
**Parameters**
- `options` **Object**
- `options.log` **Function** – a logging function, defaults to `console.log`
- `req` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** – the http request object
- `res` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** – the http response object

@@ -57,4 +57,4 @@ ### on

- `pathname` **String** – the route for this handler
- `callback` **Function** – the route handler
- `pathname` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** – the route for this handler
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** – the route handler

@@ -67,7 +67,7 @@ ### send

- `res` **Object** – the http response object
- `statusCode` **Number** – the status code of the response, default is 200
- `data` **Object** – the data that will be stringified into JSON
- `res` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** – the http response object
- `statusCode` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** – the status code of the response, default is 200
- `data` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** – the data that will be stringified into JSON
### sendError
### error

@@ -78,6 +78,6 @@ Send a JSON error response

- `response` **Object** – the http response object
- `response` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** – the http response object
- `res`
- `statusCode` **Number** – the status code of the response, default is 404
- `message` **String** – the message that will be stringified into JSON
- `statusCode` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** – the status code of the response, default is 404
- `message` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** – the message that will be stringified into JSON

@@ -84,0 +84,0 @@ ## License

@@ -0,0 +0,0 @@ var test = require('tape')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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