mirror of
https://github.com/usatiuk/photos.git
synced 2025-10-28 23:37:48 +01:00
more logging
todo: don't use console.log()
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -48,7 +48,8 @@ photosRouter.post("/photos/new", async (ctx) => {
|
||||
} as IPhotosNewRespBody;
|
||||
return;
|
||||
}
|
||||
ctx.throw(400);
|
||||
console.log(e);
|
||||
ctx.throw(500);
|
||||
}
|
||||
|
||||
ctx.body = {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user