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

Quickly build micro services.

  • 4.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

appa

Quickly build micro services.

Travis npm

appa

Install

Make sure you've got node installed, then make appa a project dependency:

npm install --save appa

Minimal example

var http = require('http')
var app = require('appa')()

app.on('/', function (req, res, context) {
  app.send(res, { message: 'oh hey friends' })
})

http.createServer(app).listen(3000)

API

createApp

Create the application. Returns the app function that can be passed into http.createServer.

Parameters

  • options Object
    • options.log Boolean – whether appa should log using bole. default: true

app

The request, response handler that is passed to http.createServer, and that provides methods for your app.

Parameters

  • req Object – the http request object
  • res Object – the http response object

on

Route handler

Parameters

  • pathname String – the route for this handler
  • callback Function – the route handler

send

Send a JSON response

Parameters

  • 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

error

Send a JSON error response

Parameters

  • response 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

License

MIT

FAQs

Package last updated on 01 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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