diff --git a/src/index.js b/src/index.js index cb4188c5..3cbf5040 100644 --- a/src/index.js +++ b/src/index.js @@ -31,10 +31,6 @@ const fastify = require("fastify")({ // }, // }); - - - - // fastify.register(View).ready((err) => { // if (err) console.error(err); @@ -88,6 +84,7 @@ const apiversion = "1.0.0"; const path = require("path"); // Using static content for swagger documentation. Generated swagger UI is not user friendly. + fastify.register(require("fastify-static"), { root: path.join(__dirname, "api-docs"), prefix: "/api-docs", // optional: default '/' @@ -203,7 +200,7 @@ fastify.post("/api/login", { //expiresIn: expressed in seconds or a string describing a time span zeit/ms. Eg: 60, "2 days", "10h", "7d". //A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), //otherwise milliseconds unit is used by default ("120" is equal to "120ms"). - { expiresIn: "300000" } + { expiresIn: "30d" } ); var arr = loginObject.user.profile.role; var arrayToString = JSON.stringify(Object.assign({}, arr)); // convert array to string @@ -213,7 +210,7 @@ fastify.post("/api/login", { if (!profilePicture) { reply.send({ simplydata: { - error: false, + error: false, apiversion: fastify.config.APIVERSION, access_token: token, @@ -299,7 +296,7 @@ fastify.get("/api/reset_token/:customerId", { userId: get_user._id, roles: get_user.profile.role, }, - { expiresIn: "300000" } + { expiresIn: "30d" } ); reply.send({ access_token: token, customerId: get_user.customerId }); } catch (err) {