const express = require('express'); const router = express.Router(); const nodesController = require('../controllers/nodesController'); /* GET nodes the server knows */ router.get('/', nodesController.listAllNodes); // TODO Need to authenticate this request /* GET the information the server has on a particular node */ router.get('/:nodeId', nodesController.getNodeInfo); // Update an existing node router.put('/:nodeId', nodesController.updateExistingNode); // Update an existing node's system router.put('/:nodeId/systems', nodesController.updateNodeSystem); // TODO Need to authenticate this request /* POST a new node to the server * * Will create a new DB entry for the node for the server to reference later * Req. body: { * "serverInfo": {"ip": "x.x.x.x", port: 0000} * } * * Will return a token for the client to reference when the bot is making requests * Res. body { * "serverToken": "" * } */ router.post('/newNode', nodesController.newNode); // TODO Need to authenticate this request // Client checkin with the server to update client information router.post('/nodeCheckIn/:nodeId', nodesController.nodeCheckIn); // Request a node to check in with the server router.get('/nodeCheckIn/:nodeId', nodesController.requestNodeCheckIn); module.exports = router;