http: move to node module.
This commit is contained in:
parent
5a23ba96d0
commit
cc91e3ea7b
@ -174,10 +174,6 @@ bcoin.ldb = require('./db/ldb');
|
||||
// HD
|
||||
bcoin.hd = require('./hd');
|
||||
|
||||
// HTTP
|
||||
bcoin.http = require('./http');
|
||||
bcoin.rpc = require('./http/rpc');
|
||||
|
||||
// Mempool
|
||||
bcoin.txmempool = require('./mempool');
|
||||
bcoin.fees = require('./mempool/fees');
|
||||
@ -268,9 +264,3 @@ bcoin.workerpool = require('./workers/workerpool');
|
||||
|
||||
// Package Info
|
||||
bcoin.pkg = require('./pkg');
|
||||
|
||||
/*
|
||||
* Expose Globally
|
||||
*/
|
||||
|
||||
global.bcoin = bcoin;
|
||||
|
||||
@ -211,10 +211,6 @@ bcoin.define('ldb', './db/ldb');
|
||||
// HD
|
||||
bcoin.define('hd', './hd');
|
||||
|
||||
// HTTP
|
||||
bcoin.define('http', './http');
|
||||
bcoin.define('rpc', './http/rpc');
|
||||
|
||||
// Mempool
|
||||
bcoin.define('txmempool', './mempool');
|
||||
bcoin.define('fees', './mempool/fees');
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
/*!
|
||||
* http/index.js - http for bcoin
|
||||
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
|
||||
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
|
||||
* https://github.com/bcoin-org/bcoin
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @module http
|
||||
*/
|
||||
|
||||
exports.RPC = require('./rpc');
|
||||
exports.Server = require('./server');
|
||||
@ -12,9 +12,9 @@ const Fees = require('../mempool/fees');
|
||||
const Mempool = require('../mempool/mempool');
|
||||
const Pool = require('../net/pool');
|
||||
const Miner = require('../mining/miner');
|
||||
const HTTPServer = require('../http/server');
|
||||
const RPC = require('../http/rpc');
|
||||
const Node = require('./node');
|
||||
const HTTP = require('./http');
|
||||
const RPC = require('./rpc');
|
||||
|
||||
/**
|
||||
* Respresents a fullnode complete with a
|
||||
@ -28,7 +28,7 @@ const Node = require('./node');
|
||||
* @property {Mempool} mempool
|
||||
* @property {Pool} pool
|
||||
* @property {Miner} miner
|
||||
* @property {HTTPServer} http
|
||||
* @property {HTTP} http
|
||||
* @emits FullNode#block
|
||||
* @emits FullNode#tx
|
||||
* @emits FullNode#connect
|
||||
@ -137,7 +137,7 @@ function FullNode(options) {
|
||||
this.rpc = new RPC(this);
|
||||
|
||||
// HTTP needs access to the node.
|
||||
this.http = new HTTPServer({
|
||||
this.http = new HTTP({
|
||||
network: this.network,
|
||||
logger: this.logger,
|
||||
node: this,
|
||||
|
||||
@ -22,15 +22,15 @@ const Network = require('../protocol/network');
|
||||
const Validator = require('../utils/validator');
|
||||
const pkg = require('../pkg');
|
||||
|
||||
class HTTPServer extends Server {
|
||||
class HTTP extends Server {
|
||||
/**
|
||||
* HTTPServer
|
||||
* HTTP
|
||||
* @alias module:http.Server
|
||||
* @constructor
|
||||
* @param {Object} options
|
||||
* @param {Fullnode} options.node
|
||||
* @see HTTPBase
|
||||
* @emits HTTPServer#socket
|
||||
* @emits HTTP#socket
|
||||
*/
|
||||
|
||||
constructor(options) {
|
||||
@ -794,4 +794,4 @@ function enforce(value, msg) {
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = HTTPServer;
|
||||
module.exports = HTTP;
|
||||
@ -12,6 +12,8 @@
|
||||
|
||||
exports.Config = require('./config');
|
||||
exports.FullNode = require('./fullnode');
|
||||
exports.HTTP = require('./http');
|
||||
exports.Logger = require('./logger');
|
||||
exports.Node = require('./node');
|
||||
exports.RPC = require('./rpc');
|
||||
exports.SPVNode = require('./spvnode');
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
const Lock = require('../utils/lock');
|
||||
const Chain = require('../blockchain/chain');
|
||||
const Pool = require('../net/pool');
|
||||
const HTTPServer = require('../http/server');
|
||||
const RPC = require('../http/rpc');
|
||||
const Node = require('./node');
|
||||
const HTTP = require('./http');
|
||||
const RPC = require('../rpc');
|
||||
|
||||
/**
|
||||
* Create an spv node which only maintains
|
||||
@ -28,7 +28,7 @@ const Node = require('./node');
|
||||
* @property {Boolean} loaded
|
||||
* @property {Chain} chain
|
||||
* @property {Pool} pool
|
||||
* @property {HTTPServer} http
|
||||
* @property {HTTP} http
|
||||
* @emits SPVNode#block
|
||||
* @emits SPVNode#tx
|
||||
* @emits SPVNode#error
|
||||
@ -80,7 +80,7 @@ function SPVNode(options) {
|
||||
|
||||
this.rpc = new RPC(this);
|
||||
|
||||
this.http = new HTTPServer({
|
||||
this.http = new HTTP({
|
||||
network: this.network,
|
||||
logger: this.logger,
|
||||
node: this,
|
||||
|
||||
@ -26,14 +26,14 @@ const HDPrivateKey = require('../hd/private');
|
||||
const HDPublicKey = require('../hd/public');
|
||||
const common = require('./common');
|
||||
|
||||
class HTTPServer extends Server {
|
||||
class HTTP extends Server {
|
||||
/**
|
||||
* HTTPServer
|
||||
* @alias module:wallet.HTTPServer
|
||||
* HTTP
|
||||
* @alias module:wallet.HTTP
|
||||
* @constructor
|
||||
* @param {Object} options
|
||||
* @see HTTPBase
|
||||
* @emits HTTPServer#socket
|
||||
* @emits HTTP#socket
|
||||
*/
|
||||
|
||||
constructor(options) {
|
||||
@ -1105,4 +1105,4 @@ function enforce(value, msg) {
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = HTTPServer;
|
||||
module.exports = HTTP;
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
const EventEmitter = require('events');
|
||||
const WalletDB = require('./walletdb');
|
||||
const NodeClient = require('./nodeclient');
|
||||
const HTTPServer = require('./http');
|
||||
const HTTP = require('./http');
|
||||
const RPC = require('./rpc');
|
||||
|
||||
/**
|
||||
@ -54,7 +54,7 @@ function Plugin(node) {
|
||||
|
||||
this.rpc = new RPC(this);
|
||||
|
||||
this.http = new HTTPServer({
|
||||
this.http = new HTTP({
|
||||
network: node.network,
|
||||
logger: node.logger,
|
||||
node: this,
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
const Node = require('../node/node');
|
||||
const WalletDB = require('./walletdb');
|
||||
const HTTPServer = require('./http');
|
||||
const HTTP = require('./http');
|
||||
const Client = require('./client');
|
||||
const RPC = require('./rpc');
|
||||
|
||||
@ -57,7 +57,7 @@ function WalletNode(options) {
|
||||
|
||||
this.rpc = new RPC(this);
|
||||
|
||||
this.http = new HTTPServer({
|
||||
this.http = new HTTP({
|
||||
network: this.network,
|
||||
logger: this.logger,
|
||||
node: this,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user