mirror of
https://github.com/gregor-tokarev/cubicdone.git
synced 2026-09-12 19:51:06 +05:00
add morgan logging
This commit is contained in:
parent
583c991052
commit
84895bd968
50
package-lock.json
generated
50
package-lock.json
generated
@ -11577,6 +11577,15 @@
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@types/morgan": {
|
||||
"version": "1.9.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/morgan/-/morgan-1.9.9.tgz",
|
||||
"integrity": "sha512-iRYSDKVaC6FkGSpEVVIvrRGw0DfJMiQzIn3qr2G5B3C//AWkulhXgaBd7tS9/J79GWSYMTHGs7PfI5b3Y8m+RQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/ms": {
|
||||
"version": "0.7.34",
|
||||
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
|
||||
@ -14888,6 +14897,17 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/basic-auth": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
|
||||
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/batch": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz",
|
||||
@ -25709,6 +25729,34 @@
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/morgan": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
|
||||
"integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==",
|
||||
"dependencies": {
|
||||
"basic-auth": "~2.0.1",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~2.0.0",
|
||||
"on-finished": "~2.3.0",
|
||||
"on-headers": "~1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/morgan/node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/morgan/node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
||||
},
|
||||
"node_modules/motion": {
|
||||
"version": "10.18.0",
|
||||
"resolved": "https://registry.npmjs.org/motion/-/motion-10.18.0.tgz",
|
||||
@ -36042,6 +36090,7 @@
|
||||
"express": "^4.19.2",
|
||||
"hono": "^4.0.10",
|
||||
"lucia": "^3.2.0",
|
||||
"morgan": "^1.10.0",
|
||||
"postgres": "^3.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -36049,6 +36098,7 @@
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/dotenv": "^8.2.0",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/morgan": "^1.9.9",
|
||||
"@types/node": "^20.11.17",
|
||||
"drizzle-kit": "^0.21.4",
|
||||
"pg": "^8.11.3"
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"express": "^4.19.2",
|
||||
"hono": "^4.0.10",
|
||||
"lucia": "^3.2.0",
|
||||
"morgan": "^1.10.0",
|
||||
"postgres": "^3.4.3"
|
||||
},
|
||||
"private": true,
|
||||
@ -27,6 +28,7 @@
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/dotenv": "^8.2.0",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/morgan": "^1.9.9",
|
||||
"@types/node": "^20.11.17",
|
||||
"drizzle-kit": "^0.21.4",
|
||||
"pg": "^8.11.3"
|
||||
|
||||
@ -13,16 +13,17 @@ import { webcrypto } from "node:crypto";
|
||||
import { authRouter } from "./router/auth.router";
|
||||
import { oauthRedirectRouter } from "./webhooks/oauth-redirects";
|
||||
import { oauthUrlRouter } from "./webhooks/oauth-url";
|
||||
import morgan from "morgan";
|
||||
|
||||
globalThis.crypto = webcrypto as Crypto;
|
||||
|
||||
const appRouter = router({
|
||||
draft: drafts,
|
||||
task: tasks,
|
||||
project: projects,
|
||||
apiKey: apiKeys,
|
||||
projectStatus: projectStatus,
|
||||
auth: authRouter,
|
||||
draft: drafts,
|
||||
task: tasks,
|
||||
project: projects,
|
||||
apiKey: apiKeys,
|
||||
projectStatus: projectStatus,
|
||||
auth: authRouter,
|
||||
});
|
||||
|
||||
export type AppRouter = typeof appRouter;
|
||||
@ -30,10 +31,10 @@ export type AppRouter = typeof appRouter;
|
||||
const app = express();
|
||||
|
||||
app.use(
|
||||
cors({
|
||||
origin: ["http://localhost:3000", "https://app.cubicdone.com"],
|
||||
credentials: true,
|
||||
}),
|
||||
cors({
|
||||
origin: ["http://localhost:3000", "https://app.cubicdone.com"],
|
||||
credentials: true,
|
||||
}),
|
||||
);
|
||||
|
||||
app.use(cookieParser());
|
||||
@ -42,7 +43,9 @@ app.use("/oauth", oauthUrlRouter);
|
||||
app.use("/oauth/redirect", oauthRedirectRouter);
|
||||
|
||||
app.use(
|
||||
trpcExpress.createExpressMiddleware({ router: appRouter, createContext }),
|
||||
trpcExpress.createExpressMiddleware({ router: appRouter, createContext }),
|
||||
);
|
||||
|
||||
app.use(morgan('common', { skip: (_req, res) => res.statusCode > 400 }))
|
||||
|
||||
app.listen(4000);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user