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

osm-p2p-server

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

osm-p2p-server

serve osm http endpoints over a p2p db

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
107
increased by494.44%
Maintainers
1
Weekly downloads
 
Created
Source

osm-p2p-server

serve open street map 0.6 api endpoints over a local p2p http server

example

var level = require('level')
var hyperlog = require('hyperlog')
var fdstore = require('fd-chunk-store')
var db = {
  log: level('/tmp/osm-p2p/log'),
  index: level('/tmp/osm-p2p/index')
}

var osmdb = require('osm-p2p-db')
var osm = osmdb({
  log: hyperlog(db.log, { valueEncoding: 'json' }),
  db: db.index,
  store: fdstore(4096, '/tmp/osm-p2p/tree'),
  size: 4096
})

var osmrouter = require('osm-p2p-server')
var router = osmrouter(osm)

var http = require('http')
var server = http.createServer(function (req, res) {
  if (router.handle(req, res)) {}
  else {
    res.statusCode = 404
    res.end('not found\n')
  }
})
server.listen(5000)

api

var osmrouter = require('osm-p2p-server')

var router = osmrouter(osm)

Create a new open street maps server router given an osm-p2p-db handle osm.

var m = router.match(method, url)

Return a match object m if method and url can be handled by the server.

var m = router.handle(req, res)

Match the req.method and req.url and dispatch m.fn(m, req, res) and return the match object if there is a match.

install

npm install osm-p2p-server

license

BSD

Keywords

FAQs

Package last updated on 01 Jan 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