more logging

todo: don't use console.log()
This commit is contained in:
2020-10-19 22:34:31 +03:00
committed by Stepan Usatiuk
parent 2a9787d39f
commit 075f24fc43
3 changed files with 7 additions and 3 deletions

View File

@@ -23,8 +23,8 @@ const tmpPath = path.join(config.dataDir, "tmp");
// Create both data dir if it doesn't exist and temp dir
fs.mkdirSync(tmpPath, { recursive: true });
app.use(cors());
app.use(logger());
app.use(cors());
app.use(
bodyParser({
multipart: true,

View File

@@ -48,7 +48,8 @@ photosRouter.post("/photos/new", async (ctx) => {
} as IPhotosNewRespBody;
return;
}
ctx.throw(400);
console.log(e);
ctx.throw(500);
}
ctx.body = {

View File

@@ -90,6 +90,8 @@ userRouter.post("/users/signup", async (ctx) => {
if (e.code === "ER_DUP_ENTRY") {
ctx.throw(400, "User already exists");
}
console.log(e);
ctx.throw(500);
}
ctx.body = { error: false, data: user.toAuthJSON() } as IUserSignupRespBody;
@@ -130,7 +132,8 @@ userRouter.post("/users/edit", async (ctx) => {
try {
await user.save();
} catch (e) {
ctx.throw(400);
console.log(e);
ctx.throw(500);
}
ctx.body = { error: false, data: user.toAuthJSON() } as IUserEditRespBody;