diff --git a/api/addClient.js b/api/addClient.js index 9eac8f4..922dd96 100644 --- a/api/addClient.js +++ b/api/addClient.js @@ -1,6 +1,6 @@ -module.exports = (ctx) => { - + +module.exports = (ctx) => { ctx.body = { message: 'Example POST API', data: ctx.request.body diff --git a/package.json b/package.json index dca6e3f..904b132 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "author": "kubbo", "license": "ISC", "dependencies": { + "axios": "^1.7.9", "dotenv": "^16.4.7", "jsonwebtoken": "^9.0.2", "koa": "^2.15.4", @@ -18,4 +19,4 @@ "koa-router": "^13.0.1", "nodemon": "^3.0.2" } -} \ No newline at end of file +} diff --git a/utils/http.js b/utils/http.js new file mode 100644 index 0000000..7c03ecb --- /dev/null +++ b/utils/http.js @@ -0,0 +1,3 @@ +require("dotenv").config(); +const { default: axios } = require("axios"); +module.exports = (baseURL = process.env.BASE_URL) => axios.create({ baseURL: BASE_URL });