Skip to content

Commit

Permalink
setup communication
Browse files Browse the repository at this point in the history
  • Loading branch information
PenTest-duck committed May 30, 2024
1 parent eecd5eb commit ec671b0
Show file tree
Hide file tree
Showing 10 changed files with 293 additions and 112 deletions.
56 changes: 37 additions & 19 deletions backend/package-lock.json

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

8 changes: 5 additions & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"type-check": "tsc --noemit"
},
"dependencies": {
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/node": "^20.12.13",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"typescript": "^5.4.5",
"@types/express": "^4.17.21",
"@types/node": "^20.12.13"
"typescript": "^5.4.5"
},
"devDependencies": {
"nodemon": "^3.1.2",
Expand Down
5 changes: 5 additions & 0 deletions backend/src/controllers/ping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { RequestHandler } from "express";

export const PingHandler: RequestHandler = (req, res) => {
res.status(200).send("Ping success!");
}
8 changes: 8 additions & 0 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import express, { Express } from "express";
import cors from "cors";
import dotenv from "dotenv";
import pingRoute from "./routes/ping";

dotenv.config();

const app: Express = express();
const port = process.env.PORT || 9000;

// Middleware
app.use(express.json());
app.use(cors());

app.use(pingRoute);

app.listen(port, () => {
console.log(`Server successfully started on port ${port}`);
});
8 changes: 8 additions & 0 deletions backend/src/routes/ping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Router } from "express";
import { PingHandler } from "../controllers/ping";

const router = Router();

router.get("/ping", PingHandler);

export default router;
3 changes: 2 additions & 1 deletion frontend/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ npm-debug.log
build
.git
*.md
.gitignore
.gitignore
.env.local
5 changes: 5 additions & 0 deletions frontend/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### TODO: make private

# Backend
NEXT_PUBLIC_BACKEND_HOST=localhost
NEXT_PUBLIC_BACKEND_PORT=9000
Loading

0 comments on commit ec671b0

Please sign in to comment.