Skip to content

Commit c51ced2

Browse files
committed
chapter 04: creating the real webService connector
1 parent 8b1bdd8 commit c51ced2

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const axios = require('axios').default;
2+
3+
function webService() {
4+
/**
5+
* @param {string} message
6+
*/
7+
async function logError(message) {
8+
return axios({
9+
method: 'POST',
10+
url: 'http://localhost:3000',
11+
data: message,
12+
});
13+
}
14+
15+
return {
16+
logError,
17+
};
18+
}
19+
20+
module.exports = webService;

package-lock.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"homepage": "https://github.com/devcorpio/the-art-of-unit-testing#readme",
1919
"devDependencies": {
2020
"@types/node": "^10.12.18",
21+
"axios": "^0.18.0",
2122
"husky": "^1.3.1",
2223
"jest": "^23.6.0",
2324
"prettier": "1.15.3",

0 commit comments

Comments
 (0)