From 12d93ba3ae2bac5e933d5ea45f3f6c65ba70cb65 Mon Sep 17 00:00:00 2001 From: Thor Lund Hansen Date: Tue, 28 Nov 2023 12:42:33 +0100 Subject: [PATCH 1/4] added hemlet --- package.json | 1 + src/index.ts | 5 ++++- yarn.lock | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9798c4d..234d64a 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "cors": "^2.8.5", "express-validator": "^7.0.1", "firebase": "10.5.0", + "helmet": "^7.1.0", "jsonwebtoken": "^9.0.2", "nodemailer": "^6.9.7" }, diff --git a/src/index.ts b/src/index.ts index 645c861..03ed094 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,19 +4,22 @@ import userRoutes from './routes/users'; import cors from 'cors'; import { errorLogger, errorResponder, invalidPathHandler } from './errorHandler/handlerForExpress'; import { errors } from 'celebrate'; +import helmet from 'helmet'; export const app = express(); const port = process.env.PORT || 3000; + app.use(express.json()); app.use(cors()); +app.use(helmet()); app.use('/events', eventRoutes); app.use('/users', userRoutes); app.get('/', (req: Request, res: Response) => { res.send( - 'Hello dumbass, this is the backend. Go to localhost:3010/ to see the app', + 'Hello, this is the backend.', ); }); // Catch celebrate validation errors diff --git a/yarn.lock b/yarn.lock index 5130673..8ccb9f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3026,6 +3026,11 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" +helmet@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/helmet/-/helmet-7.1.0.tgz#287279e00f8a3763d5dccbaf1e5ee39b8c3784ca" + integrity sha512-g+HZqgfbpXdCkme/Cd/mZkV0aV3BZZZSugecH03kl38m/Kmdx8jKjBikpDj2cr+Iynv4KpYEviojNdTJActJAg== + hexoid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/hexoid/-/hexoid-1.0.0.tgz#ad10c6573fb907de23d9ec63a711267d9dc9bc18" From b0dcf9214186cca286b1c096ffdcbe4cbcd7c7a0 Mon Sep 17 00:00:00 2001 From: Thor Lund Hansen Date: Tue, 28 Nov 2023 12:46:13 +0100 Subject: [PATCH 2/4] changed name --- package.json | 2 +- src/index.ts | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 234d64a..62540a0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "tsc", "serve": "node dist/index.js", "test": "jest --watch", - "martin": "prettier . --write", + "prettier": "prettier . --write", "check-types": "tsc --noEmit", "lint": "eslint src/**/*.ts" }, diff --git a/src/index.ts b/src/index.ts index 03ed094..b83fdc0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,6 @@ import helmet from 'helmet'; export const app = express(); const port = process.env.PORT || 3000; - app.use(express.json()); app.use(cors()); @@ -18,9 +17,7 @@ app.use('/events', eventRoutes); app.use('/users', userRoutes); app.get('/', (req: Request, res: Response) => { - res.send( - 'Hello, this is the backend.', - ); + res.send('Hello, this is the backend.'); }); // Catch celebrate validation errors app.use(errors()); From 204c2e8021874c2fce79f34267a26a1df31b2ab5 Mon Sep 17 00:00:00 2001 From: Thor Lund Hansen Date: Tue, 28 Nov 2023 12:47:05 +0100 Subject: [PATCH 3/4] martin er dum --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index acaaec4..0b23c0f 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Starts the api, you would now be able to make calls, look at the api doc ### `yarn test` Runs all tests (see [jest](https://jestjs.io) for more). -### `yarn martin` +### `yarn prettier` **ToDo cahnge name** Formats the code according to the [.prettierrc](https://github.com/5-semesterprojekt/Backend/blob/main/.prettierrc). From 72ce97e1d2eabfe299a3abb6bb9b256b83958e84 Mon Sep 17 00:00:00 2001 From: Thor Lund Hansen Date: Tue, 28 Nov 2023 12:47:54 +0100 Subject: [PATCH 4/4] fuck dig martin --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 0b23c0f..cbdcc11 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,6 @@ Starts the api, you would now be able to make calls, look at the api doc Runs all tests (see [jest](https://jestjs.io) for more). ### `yarn prettier` -**ToDo cahnge name** Formats the code according to the [.prettierrc](https://github.com/5-semesterprojekt/Backend/blob/main/.prettierrc).