From 075fb4c7a2b0c609477c083b877dc5b50ce00866 Mon Sep 17 00:00:00 2001 From: Victor Algaze Date: Wed, 19 Jun 2024 01:05:15 -0700 Subject: [PATCH] tidy up standard-server example --- examples/standard-server/package.json | 3 ++- examples/standard-server/src/index.ts | 2 +- examples/standard-server/util/index.ts | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/standard-server/package.json b/examples/standard-server/package.json index 488cc14..948a623 100644 --- a/examples/standard-server/package.json +++ b/examples/standard-server/package.json @@ -26,13 +26,14 @@ "author": "valgaze@gmail.com", "license": "ISC", "devDependencies": { - "tsx": "^4.7.0", "@types/express": "^4.17.21", "@types/node": "^20.10.1", + "tsx": "^4.7.0", "typescript": "^3.9.10" }, "dependencies": { "body-parser": "^1.19.0", + "cross-fetch": "^4.0.0", "dotenv": "^16.0.3", "express": "^4.17.1", "speedybot": "^2.0.0" diff --git a/examples/standard-server/src/index.ts b/examples/standard-server/src/index.ts index 21971f0..8a8dd0d 100644 --- a/examples/standard-server/src/index.ts +++ b/examples/standard-server/src/index.ts @@ -1,6 +1,6 @@ import * as bodyParser from "body-parser"; import { config } from "dotenv"; -import * as express from "express"; +import express from "express"; import { resolve } from "path"; import Bot from "./../settings/bot"; import { validateWebhook } from "./validateWebhook"; diff --git a/examples/standard-server/util/index.ts b/examples/standard-server/util/index.ts index 33ad033..fa48f67 100644 --- a/examples/standard-server/util/index.ts +++ b/examples/standard-server/util/index.ts @@ -7,11 +7,13 @@ export const announceReady = ( ) => { const isColorSupported = process.stdout.isTTY; console.log(logoRoll()); + const msg = `Server active on port ${port} +You must expose this port & register for incoming webhooks. Listening...`; if (isColorSupported) { - const ServerReady = `\x1b[1m\x1b[7m\x1b[32m 🌐 CONNECTED \x1b[0m\x1b[32m Server active on ${port}, listening...\x1b[0m`; + const ServerReady = `\x1b[1m\x1b[7m\x1b[32m 🌐 CONNECTED \x1b[0m\x1b[32m ${msg}\x1b[0m`; process.stdout.write(ServerReady + "\n"); } else { - console.log("Websockets Registered. Listening..."); + console.log(`🌐 CONNECTED ${msg}`); } console.log(`You can reach ${name} here: ${email}`); };