-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
34 lines (29 loc) · 827 Bytes
/
app.js
File metadata and controls
34 lines (29 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import express from "express";
import { PORT } from "./config/env.js";
import siweRouter from "./routes/siwe.js";
import session from "express-session"
import cors from "cors";
import cookieParser from "cookie-parser";
const app = express();
app.use(cors({
origin: "http://localhost:3000", // your frontend URL
credentials: true,
}))
app.use(express.json()); // parse JSON request bodies
app.use(cookieParser());
// Session middleware for storing nonce
app.use(
session({
secret: "your-secret-key", // change this in production
resave: false,
saveUninitialized: true,
cookie: { secure: false }, // true only for HTTPS
}),
);
app.use("/siwe", siweRouter);
app.get("/", (req, res) => {
res.send("Hello World!");
});
app.listen(5000, () => {
console.log(`Server is running on port: ${PORT}`);
});