mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-08 12:18:46 +00:00
added function to the login
This commit is contained in:
parent
0da02cb599
commit
aab893e890
8 changed files with 292 additions and 174 deletions
|
@ -5,12 +5,21 @@ import userRouter from "./routes/userRoutes";
|
|||
import postRouter from "./routes/postRoutes";
|
||||
import { authenticateToken } from "./middleware/authenticateToken";
|
||||
import bodyParser from "body-parser";
|
||||
|
||||
import cors from "cors";
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
|
||||
const port = 3001;
|
||||
app.use(
|
||||
cors({
|
||||
origin: "http://localhost:3000",
|
||||
credentials: true,
|
||||
})
|
||||
);
|
||||
app.use((req, res, next) => {
|
||||
res.header("Access-Control-Expose-Headers", "Authorization");
|
||||
next();
|
||||
});
|
||||
// minIO config
|
||||
export const minioClient = new Client({
|
||||
endPoint: "localhost", // Replace with your MinIO server URL
|
||||
|
@ -34,7 +43,7 @@ const options = {
|
|||
},
|
||||
servers: [
|
||||
{
|
||||
url: "http://localhost:3000",
|
||||
url: `http://localhost:${port}`,
|
||||
},
|
||||
],
|
||||
components: {
|
||||
|
@ -56,7 +65,6 @@ const options = {
|
|||
};
|
||||
const specs = swaggerJSDoc(options);
|
||||
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(specs));
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use("/api/user", userRouter);
|
||||
app.use("/api/posts", authenticateToken(), postRouter);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue