Skip to content

Commit

Permalink
Merge pull request #42 from Praashh/inmemory/orderbook
Browse files Browse the repository at this point in the history
feat: opx-orderbook
  • Loading branch information
Praashh authored Oct 9, 2024
2 parents c82961d + 1c6c57d commit 5763c29
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 0 deletions.
27 changes: 27 additions & 0 deletions apps/opx-orderbook/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
23 changes: 23 additions & 0 deletions apps/opx-orderbook/src/index.ts
Original file line number Diff line number Diff line change
@@ -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`);
});
8 changes: 8 additions & 0 deletions apps/opx-orderbook/src/routes/placeorders.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Router } from "express";
const router = Router();

router.post("/placeorder", async (req, res)=>{
res.json({message: "working"});
})

export default router;
8 changes: 8 additions & 0 deletions apps/opx-orderbook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@repo/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5763c29

Please sign in to comment.