Skip to content
Snippets Groups Projects
Commit 56fc550e authored by Daniel's avatar Daniel
Browse files

app: Use global model

parent 4ef96f04
Branches
No related merge requests found
......@@ -6,12 +6,10 @@
const express = require('express')
const Hub = require('../model/Hub.js')
const hub = require('../model/hub.js')
let app = express.Router()
let hub = new Hub()
app.get('/find', function (req, res) {
let location = req.query.location
......@@ -20,16 +18,6 @@ app.get('/find', function (req, res) {
})
})
app.get('/:id', function (req, res) {
let id = req.params.id
if (hub.drivers[id]) {
res.json({})
} else {
res.status(404).json({ 'error': 'Driver is not found' })
}
})
app.post('/', async function (req, res) {
let id = req.body.driver_id
let locations = req.body.locations
......
......@@ -93,4 +93,4 @@ class Hub {
}
}
module.exports = Hub
module.exports = new Hub()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment