mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 12:11:36 +00:00
examples/express-embed
This commit is contained in:
parent
79068a49cf
commit
3b4b487c2c
13
examples/express-embed/package.json
Normal file
13
examples/express-embed/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "bittorrent-tracker-example-express-embed",
|
||||
"version": "0.0.0",
|
||||
"description": "Example for embedding bittorrent-tracker server in express.js",
|
||||
"scripts": {
|
||||
"server": "./server.js"
|
||||
},
|
||||
"author": "Astro <astro@spaceboyz.net>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"express": "^4.10.5"
|
||||
}
|
||||
}
|
16
examples/express-embed/server.js
Executable file
16
examples/express-embed/server.js
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var Server = require('../..').Server
|
||||
var express = require('express')
|
||||
var app = express()
|
||||
|
||||
var server = new Server({
|
||||
http: false, // we do our own
|
||||
udp: false // not interested
|
||||
})
|
||||
|
||||
var onHttpRequest = server._onHttpRequest.bind(server)
|
||||
app.get('/announce', onHttpRequest)
|
||||
app.get('/scrape', onHttpRequest)
|
||||
|
||||
app.listen(8080)
|
Loading…
Reference in New Issue
Block a user