git ssb

1+

Rômulo Alves / dat-react-native



Tree: 0b835dd3b9f970b3fdb54c75f7deb520f1552357

Files: 0b835dd3b9f970b3fdb54c75f7deb520f1552357 / nodejs-assets / nodejs-project / message.js

680 bytesRaw
1/**
2 * @function error
3 * @description Creates an stringified JSON error message
4 * @param {Object} Error to return
5 * @return {String} Error message as JSON
6 */
7module.exports.error = err => JSON.stringify({
8 type: 'error',
9 data: err
10});
11
12/**
13 * @function ok
14 * @description Creates an stringified JSON to OK message
15 * @return {String} OK message as JSON
16 */
17module.exports.ok = () => JSON.stringify({
18 type: 'ok'
19});
20
21/**
22 * @function port
23 * @description Creates an stringified JSON to send the server port
24 * @param {Number} port Port of the server
25 * @return {String} Message as JSON
26 */
27module.exports.port = port => JSON.stringify({
28 type: 'port',
29 data: port
30});

Built with git-ssb-web