-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
40 lines (34 loc) · 837 Bytes
/
index.js
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
35
36
37
38
39
40
import express from "express";
import cors from "cors";
const app = express();
app.use(cors({ origin: "http://localhost:4200" }));
// app.use((req, res, next) => {
// res.setHeader("Access-Control-Allow-Origin", "*");
// res.setHeader(
// "Access-Control-Allow-Headers",
// "Origin, X-Requested-With, Content-Type, Accept"
// );
// res.setHeader(
// "Access-Control-Allow-Methods",
// "GET, POST, PATCH, DELETE, OPTIONS"
// );
// next();
// });
app.use("/api/login", (req, res, next) => {
// res.send("hello from index.js");
const users = [
{
username: "Silviu",
password: "123456",
},
{
username: "Diogo",
password: "010101",
},
];
return res.status(200).json({
message: "User fetched succesfully!",
users: users,
});
});
export default app;