diff --git a/package.json b/package.json index b632e1d..40b309c 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "jsonwebtoken": "^9.0.2", "lodash-es": "^4.17.21", "maxmind": "^4.3.11", + "morgan": "^1.10.0", "nanoid": "^3.3.6", "passport": "^0.6.0", "passport-jwt": "^4.0.1", @@ -57,6 +58,7 @@ "@types/express": "^4.17.17", "@types/jsonwebtoken": "^9.0.2", "@types/lodash-es": "^4.17.9", + "@types/morgan": "^1.9.5", "@types/node": "^18.17.12", "@types/passport": "^1.0.12", "@types/passport-jwt": "^3.0.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ebd6d1a..1289c8e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,6 +64,9 @@ dependencies: maxmind: specifier: ^4.3.11 version: 4.3.11 + morgan: + specifier: ^1.10.0 + version: 1.10.0 nanoid: specifier: ^3.3.6 version: 3.3.6 @@ -129,6 +132,9 @@ devDependencies: '@types/lodash-es': specifier: ^4.17.9 version: 4.17.9 + '@types/morgan': + specifier: ^1.9.5 + version: 1.9.5 '@types/node': specifier: ^18.17.12 version: 18.17.12 @@ -1962,6 +1968,12 @@ packages: resolution: {integrity: sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==} dev: true + /@types/morgan@1.9.5: + resolution: {integrity: sha512-5TgfIWm0lcTGnbCZExwc19dCOMOMmAiiBZQj8Ko3NRxsVDgRxf+AEGRQTqNVA5Yh2xfdWp4clbAEMbYP+jkOqg==} + dependencies: + '@types/node': 18.17.12 + dev: true + /@types/node@18.17.12: resolution: {integrity: sha512-d6xjC9fJ/nSnfDeU0AMDsaJyb1iHsqCSOdi84w4u+SlN/UgQdY5tRhpMzaFYsI4mnpvgTivEaQd0yOUhAtOnEQ==} @@ -2312,6 +2324,13 @@ packages: engines: {node: ^4.5.0 || >= 5.9} dev: false + /basic-auth@2.0.1: + resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==} + engines: {node: '>= 0.8'} + dependencies: + safe-buffer: 5.1.2 + dev: false + /bcryptjs@2.4.3: resolution: {integrity: sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==} dev: false @@ -4009,6 +4028,19 @@ packages: resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==} dev: false + /morgan@1.10.0: + resolution: {integrity: sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==} + engines: {node: '>= 0.8.0'} + dependencies: + basic-auth: 2.0.1 + debug: 2.6.9 + depd: 2.0.0 + on-finished: 2.3.0 + on-headers: 1.0.2 + transitivePeerDependencies: + - supports-color + dev: false + /mousetrap@1.6.5: resolution: {integrity: sha512-QNo4kEepaIBwiT8CDhP98umTetp+JNfQYBWvC1pc6/OAibuXtRcxZ58Qz8skvEHYvURne/7R8T5VoOI7rDsEUA==} dev: false @@ -4137,6 +4169,13 @@ packages: object-keys: 1.1.1 dev: false + /on-finished@2.3.0: + resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} + engines: {node: '>= 0.8'} + dependencies: + ee-first: 1.1.1 + dev: false + /on-finished@2.4.1: resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} engines: {node: '>= 0.8'} diff --git a/src/client/api/model/index.ts b/src/client/api/model/index.ts index 22c2de0..2df2b22 100644 --- a/src/client/api/model/index.ts +++ b/src/client/api/model/index.ts @@ -1,5 +1,7 @@ import * as user from './user'; +import * as website from './website'; export const model = { user, + website, }; diff --git a/src/server/main.ts b/src/server/main.ts index e3993ef..4515f5c 100644 --- a/src/server/main.ts +++ b/src/server/main.ts @@ -4,6 +4,7 @@ import 'express-async-errors'; import ViteExpress from 'vite-express'; import compression from 'compression'; import passport from 'passport'; +import morgan from 'morgan'; import { userRouter } from './router/user'; import { websiteRouter } from './router/website'; import { workspaceRouter } from './router/workspace'; @@ -15,6 +16,7 @@ const app = express(); app.use(compression()); app.use(express.json()); app.use(passport.initialize()); +app.use(morgan('tiny')); // http://expressjs.com/en/advanced/best-practice-security.html#at-a-minimum-disable-x-powered-by-header app.disable('x-powered-by'); diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json new file mode 100644 index 0000000..6f83eb6 --- /dev/null +++ b/src/server/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.json", +}