-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Adamant-im/dev-states
State storing feature
- Loading branch information
Showing
11 changed files
with
1,188 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
var Router = require('../../helpers/router'); | ||
var httpApi = require('../../helpers/httpApi'); | ||
|
||
|
||
/** | ||
* Binds api with modules and creates common url. | ||
* - End point: `/api/states` | ||
* - Private API: | ||
* - post /normalize | ||
* - post /finalize | ||
* | ||
* - Sanitized | ||
* - get /get | ||
* @memberof module:states | ||
* @requires helpers/Router | ||
* @requires helpers/httpApi | ||
* @constructor | ||
* @param {Object} statesModule - Module storing options state | ||
* @param {scope} app - Network app. | ||
*/ | ||
// Constructor | ||
function StatesHttpApi (statesModule, app) { | ||
|
||
var router = new Router(); | ||
|
||
router.map(statesModule.internal, { | ||
'get /get': 'getTransactions', | ||
'post /normalize': 'normalize', | ||
'post /store': 'store' | ||
}); | ||
|
||
|
||
httpApi.registerEndpoint('/api/states', app, router, statesModule.isLoaded); | ||
} | ||
|
||
module.exports = StatesHttpApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ module.exports = { | |
DAPP: 5, | ||
IN_TRANSFER: 6, | ||
OUT_TRANSFER: 7, | ||
CHAT_MESSAGE: 8 | ||
CHAT_MESSAGE: 8, | ||
STATE: 9 | ||
}; |
Oops, something went wrong.