Skip to content

Commit

Permalink
Add Favicon second try (#17)
Browse files Browse the repository at this point in the history
* Add Favicon

* path
  • Loading branch information
lipis authored Nov 28, 2021
1 parent 584a8eb commit 22534c5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
build
index.js
keys
node_modules
2 changes: 1 addition & 1 deletion esbuild.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require("esbuild").buildSync({
entryPoints: ["index.ts"],
outfile: "build/index.js",
outfile: "index.js",
bundle: true,
platform: "node",
});
3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Storage } from "@google-cloud/storage";
import cors from "cors";
import express from "express";
import { nanoid } from "nanoid";
import favicon from "serve-favicon";
import * as path from "path";

const PROJECT_NAME = process.env.GOOGLE_CLOUD_PROJECT || "excalidraw-json-dev";
const PROD = PROJECT_NAME === "excalidraw-json";
Expand Down Expand Up @@ -48,6 +50,7 @@ const corsPost = cors((req, callback) => {
callback(null, { origin: isGood });
});

app.use(favicon(path.join(__dirname, "favicon.ico")));
app.get("/", (req, res) => res.sendFile(`${process.cwd()}/index.html`));

app.get("/api/v2/:key", corsGet, async (req, res) => {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"devDependencies": {
"@types/cors": "2.8.12",
"@types/express": "4.17.13",
"@types/serve-favicon": "2.5.3",
"esbuild": "0.13.15",
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
Expand All @@ -19,7 +20,8 @@
"@google-cloud/storage": "5.16.0",
"cors": "2.8.5",
"express": "4.17.1",
"nanoid": "3.1.30"
"nanoid": "3.1.30",
"serve-favicon": "2.5.0"
},
"lint-staged": {
"*.{ts,js,json,md,html,yml}": [
Expand All @@ -34,7 +36,7 @@
"fix": "yarn prettier --write",
"prepare": "husky install",
"prettier": "prettier \"**/*.{ts,js,json,md,html,yml}\" --ignore-path=.gitignore",
"start": "node build/index.js",
"start": "node index.js",
"test": "yarn prettier --list-different"
}
}
27 changes: 25 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@types/qs" "*"
"@types/range-parser" "*"

"@types/[email protected]":
"@types/express@*", "@types/express@4.17.13":
version "4.17.13"
resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.13.tgz#a76e2995728999bab51a33fabce1d705a3709034"
integrity sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==
Expand Down Expand Up @@ -124,6 +124,13 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==

"@types/[email protected]":
version "2.5.3"
resolved "https://registry.yarnpkg.com/@types/serve-favicon/-/serve-favicon-2.5.3.tgz#6380c875059711090631abea8f3edc5906cccd32"
integrity sha512-HirXLRJjLXzwiSnjhE1vMu55X7+qaY+noXsKqi/7eK1uByl3L6TwkcALZuJnQXqOalMdmBz3b662yXvaR+89Vw==
dependencies:
"@types/express" "*"

"@types/serve-static@*":
version "1.13.10"
resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.10.tgz#f5e0ce8797d2d7cc5ebeda48a52c96c4fa47a8d9"
Expand Down Expand Up @@ -1296,7 +1303,7 @@ p-map@^4.0.0:
dependencies:
aggregate-error "^3.0.0"

parseurl@~1.3.3:
parseurl@~1.3.2, parseurl@~1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
Expand Down Expand Up @@ -1435,6 +1442,11 @@ rxjs@^7.4.0:
dependencies:
tslib "~2.1.0"

[email protected]:
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
integrity sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==

[email protected]:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
Expand Down Expand Up @@ -1474,6 +1486,17 @@ [email protected]:
range-parser "~1.2.1"
statuses "~1.5.0"

[email protected]:
version "2.5.0"
resolved "https://registry.yarnpkg.com/serve-favicon/-/serve-favicon-2.5.0.tgz#935d240cdfe0f5805307fdfe967d88942a2cbcf0"
integrity sha1-k10kDN/g9YBTB/3+ln2IlCosvPA=
dependencies:
etag "~1.8.1"
fresh "0.5.2"
ms "2.1.1"
parseurl "~1.3.2"
safe-buffer "5.1.1"

[email protected]:
version "1.14.1"
resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9"
Expand Down

0 comments on commit 22534c5

Please sign in to comment.