Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created March 29, 2019 17:38
Show Gist options
  • Save ntakouris/c8b4bb886eb5869334854c94811ed232 to your computer and use it in GitHub Desktop.
Save ntakouris/c8b4bb886eb5869334854c94811ed232 to your computer and use it in GitHub Desktop.
const ApiBaseUrl = process.env.API_URL
const BasePrefix = '/api'
const Base = ApiBaseUrl + BasePrefix + '/v1'
const NodesBase = Base + '/nodes'
const ApiRoutes = {
ApiBaseUrl: ApiBaseUrl,
Nodes: {
GetAll: NodesBase,
GetDetailsById: nodeId => NodesBase + '/' + nodeId,
ShutdownById: nodeId => NodesBase + '/' + nodeId + '/shutdown',
StartFirmwareUpdateById: nodeId => NodesBase + '/' + nodeId + '/firmwareupdate',
GetRegistersByNodeId: nodeId => NodesBase + '/' + nodeId + '/registers',
UpdateRegisterByNameAndNodeId: (nodeId, param) => NodesBase + '/' + nodeId + '/registers/' + param
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment