Skip to content

Conversation

ricardojlrufino
Copy link

No description provided.


//switch the device
server.get('/devices/:deviceId/:state', function (req, res) {
server.get('/devices/:deviceId/:index/:state', function (req, res) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but this would break the compatibility with the existing implementation. Could you create a secound "get" with this parameter? You might want to export the functionality to a new function and call it by both paths.

function devices(deviceId, index, state, res) {
....
}

server.get('/devices/:deviceId/:index/:state', function (req, res) {
devices(req.params.deviceId, req.params.index, req.params.state, res)
}

server.get('/devices/:deviceId/:state', function (req, res) {
devices(req.params.deviceId, req.params.index, req.params.state, res)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants