diff --git a/apps/opx-orderbook/package.json b/apps/opx-orderbook/package.json new file mode 100644 index 00000000..1508245d --- /dev/null +++ b/apps/opx-orderbook/package.json @@ -0,0 +1,27 @@ +{ + "name": "opx-orderbook", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "start": "node dist/index.js", + "build": "npx esbuild ./src/index.ts --bundle --platform=node --outfile=dist/index.js", + "dev": "npm run build && npm run start" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "@repo/db": "*", + "@repo/order-queue": "*", + "@types/cors": "^2.8.17", + "@types/express": "^4.17.21", + "body-parser": "^1.20.3", + "cors": "^2.8.5", + "dotenv": "^16.4.5", + "express": "^4.21.0" + }, + "devDependencies": { + "esbuild": "0.24.0" + } +} diff --git a/apps/opx-orderbook/src/index.ts b/apps/opx-orderbook/src/index.ts new file mode 100644 index 00000000..7f3d1027 --- /dev/null +++ b/apps/opx-orderbook/src/index.ts @@ -0,0 +1,23 @@ +import prisma from "@repo/db/client"; +import { redisClient } from "@repo/order-queue"; +import express from "express"; +import cors from "cors"; +import bodyParser from "body-parser"; +import orderRouter from "./routes/placeorders" + +const app = express(); + +app.use(cors()); +app.use(bodyParser.json()); +app.use("/v1/order", orderRouter); + +app.get("/", (req, res) => { + redisClient.connect().then(() => { + console.log("Connected to Redis"); + }); + res.send("Helo helo"); +}); + +app.listen(3002, () => { + console.log(`Server is running at http://localhost:3002`); +}); diff --git a/apps/opx-orderbook/src/routes/placeorders.ts b/apps/opx-orderbook/src/routes/placeorders.ts new file mode 100644 index 00000000..ea15e701 --- /dev/null +++ b/apps/opx-orderbook/src/routes/placeorders.ts @@ -0,0 +1,8 @@ +import { Router } from "express"; +const router = Router(); + +router.post("/placeorder", async (req, res)=>{ + res.json({message: "working"}); +}) + +export default router; \ No newline at end of file diff --git a/apps/opx-orderbook/tsconfig.json b/apps/opx-orderbook/tsconfig.json new file mode 100644 index 00000000..0ef4a4bc --- /dev/null +++ b/apps/opx-orderbook/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@repo/typescript-config/base.json", + "compilerOptions": { + "outDir": "dist" + }, + "include": ["src"], + "exclude": ["node_modules", "dist"] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 252b18b8..1bfc584c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -327,6 +327,23 @@ "typescript": "^5" } }, + "apps/opx-orderbook": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@repo/db": "*", + "@repo/order-queue": "*", + "@types/cors": "^2.8.17", + "@types/express": "^4.17.21", + "body-parser": "^1.20.3", + "cors": "^2.8.5", + "dotenv": "^16.4.5", + "express": "^4.21.0" + }, + "devDependencies": { + "esbuild": "0.24.0" + } + }, "apps/server": { "version": "1.0.0", "license": "ISC", @@ -9959,6 +9976,10 @@ "node": ">= 0.8.0" } }, + "node_modules/opx-orderbook": { + "resolved": "apps/opx-orderbook", + "link": true + }, "node_modules/ora": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ora/-/ora-4.1.1.tgz",