mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
Customizing for bch
This commit is contained in:
Vendored
+1
-1
@@ -15,7 +15,7 @@ const ipfsCoordName = process.env.COORD_NAME
|
||||
|
||||
module.exports = {
|
||||
// Configure TCP port.
|
||||
port: process.env.PORT || 5002,
|
||||
port: process.env.PORT || 5700,
|
||||
|
||||
// Password for HTML UI that displays logs.
|
||||
logPass: 'test',
|
||||
|
||||
@@ -49,6 +49,18 @@ class OrderRESTControllerLib {
|
||||
}
|
||||
}
|
||||
|
||||
// curl -X GET http://localhost:5700/order/list
|
||||
async listOrders (ctx) {
|
||||
try {
|
||||
const orders = await _this.useCases.order.listOrders()
|
||||
|
||||
ctx.body = orders
|
||||
} catch (err) {
|
||||
console.log('Error in listOrders REST API handler.')
|
||||
_this.handleError(ctx, err)
|
||||
}
|
||||
}
|
||||
|
||||
// DRY error handler
|
||||
handleError (ctx, err) {
|
||||
console.log('err', err.message)
|
||||
|
||||
@@ -50,6 +50,7 @@ class OrderRouter {
|
||||
|
||||
// Define the routes and attach the controller.
|
||||
this.router.post('/', _this.orderRESTController.createOrder)
|
||||
this.router.get('/list', _this.orderRESTController.listOrders)
|
||||
|
||||
// Attach the Controller routes to the Koa app.
|
||||
app.use(_this.router.routes())
|
||||
|
||||
@@ -56,6 +56,15 @@ class OrderUseCases {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
async listOrders () {
|
||||
try {
|
||||
return this.OrderModel.find({})
|
||||
} catch (error) {
|
||||
console.error('Error in use-cases/order/listOrders()')
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OrderUseCases
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
const axios = require('axios')
|
||||
|
||||
const LOCALHOST = 'http://localhost:5002'
|
||||
const LOCALHOST = 'http://localhost:5700'
|
||||
|
||||
async function start () {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user