diff --git a/controllers/middleware.js b/controllers/middleware.js new file mode 100644 index 0000000..8fa1b63 --- /dev/null +++ b/controllers/middleware.js @@ -0,0 +1,12 @@ +const express = require('express'); +const favicon = require('serve-favicon'); +const path = require('path'); + +const app = express(); + +// Serve the favicon from the 'public' folder +app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); + +// Other routes and middleware... + +app.listen(3000); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5c302ee..fa2ee22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,8 @@ "lodash": "^4.17.21", "mongoose": "^7.6.3", "passport": "^0.6.0", - "passport-local-mongoose": "^8.0.0" + "passport-local-mongoose": "^8.0.0", + "serve-favicon": "^2.5.0" }, "devDependencies": { "nodemon": "^3.0.1", @@ -1314,6 +1315,28 @@ "node": ">= 0.6" } }, + "node_modules/serve-favicon": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.5.0.tgz", + "integrity": "sha512-FMW2RvqNr03x+C0WxTyu6sOv21oOjkq5j8tjquWccwa6ScNyGFOGJVpuS1NmTVGBAHS07xnSKotgf2ehQmf9iA==", + "license": "MIT", + "dependencies": { + "etag": "~1.8.1", + "fresh": "0.5.2", + "ms": "2.1.1", + "parseurl": "~1.3.2", + "safe-buffer": "5.1.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-favicon/node_modules/ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "license": "MIT" + }, "node_modules/serve-static": { "version": "1.13.2", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", @@ -2464,6 +2487,25 @@ } } }, + "serve-favicon": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/serve-favicon/-/serve-favicon-2.5.0.tgz", + "integrity": "sha512-FMW2RvqNr03x+C0WxTyu6sOv21oOjkq5j8tjquWccwa6ScNyGFOGJVpuS1NmTVGBAHS07xnSKotgf2ehQmf9iA==", + "requires": { + "etag": "~1.8.1", + "fresh": "0.5.2", + "ms": "2.1.1", + "parseurl": "~1.3.2", + "safe-buffer": "5.1.1" + }, + "dependencies": { + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, "serve-static": { "version": "1.13.2", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", diff --git a/package.json b/package.json index 483fa9a..b404c46 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "lodash": "^4.17.21", "mongoose": "^7.6.3", "passport": "^0.6.0", - "passport-local-mongoose": "^8.0.0" + "passport-local-mongoose": "^8.0.0", + "serve-favicon": "^2.5.0" }, "devDependencies": { "nodemon": "^3.0.1",