diff --git a/src/config/index.ts b/src/config/index.ts index c11fd23..cfa7776 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -10,8 +10,6 @@ export const loadEnvironmentVariables = (): void => { config({ path: `.env.${process.env.NODE_ENV ?? "development"}` }); }; -loadEnvironmentVariables(); - /** * The environment the application is running in. */ diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index d4e27c0..0000000 --- a/src/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { validateEnvironmentVariables } from "./config/validateEnvironment"; - -validateEnvironmentVariables(); - -// eslint-disable-next-line no-console -console.log("add 1 + 2: ", 1 + 2); diff --git a/src/server.ts b/src/server.ts new file mode 100644 index 0000000..07a3b1c --- /dev/null +++ b/src/server.ts @@ -0,0 +1,19 @@ +import http, { type IncomingMessage, type ServerResponse } from "node:http"; + +import { loadEnvironmentVariables } from "./config"; +import { validateEnvironmentVariables } from "./config/validateEnvironment"; + +loadEnvironmentVariables(); +validateEnvironmentVariables(); + +const server = http.createServer( + (_request: IncomingMessage, response: ServerResponse) => { + response.writeHead(200, { "Content-Type": "text/plain" }); + response.end("Hello, World!"); + }, +); + +server.listen(3_000, () => { + // eslint-disable-next-line no-console + console.log("Server is listening on port 3000"); +});