From feaf33cbd9e6d77487982a1ef4422e910d1c1afc Mon Sep 17 00:00:00 2001 From: pogi7 Date: Sun, 22 Oct 2023 18:58:02 -0700 Subject: [PATCH] account microservice works locally --- src/account/account.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/account/account.ts b/src/account/account.ts index 61e0772f..b2a34b03 100644 --- a/src/account/account.ts +++ b/src/account/account.ts @@ -1,8 +1,20 @@ import express from "express"; import { User } from "../models/UserSchema"; +// Account microservice port +export const PORT = 5000; + +// Creates an Express application +export const app = express(); + +// Single Routing export const router = express.Router() +// Defines the structure of the error Object +interface ErrorWithMessage { + message: string +} + // Register method router.post('/register', (req: any, res: any) => { const user = new User({ @@ -37,6 +49,13 @@ router.post('/account', async (req: any, res: any) => { }); }) +// Use routes provided by the router +app.use(router) + +app.listen(PORT, () => { + console.log("Account microservice listening on port: " + PORT) +}) + // Update one // Delete one