JuliaLind /
vteam-server
| 1 | import express from "express"; |
||
| 2 | import cors from "cors"; |
||
| 3 | import dotenv from "dotenv"; |
||
| 4 | import morgan from "morgan"; |
||
| 5 | // import errorHandler from "./middleware/errors.js"; |
||
| 6 | // import apiRouter from "./routes/v1/index.js"; |
||
| 7 | |||
| 8 | dotenv.config(); |
||
| 9 | |||
| 10 | const app = express(); |
||
| 11 | const port = 1337; |
||
| 12 | |||
| 13 | app.use(morgan("dev")); |
||
| 14 | |||
| 15 | app.use(cors()); |
||
| 16 | app.use(express.json()); |
||
| 17 | |||
| 18 | app.use(express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded |
||
| 19 | |||
| 20 | // Här kan vi lägga in en middleware för att kolla API-nyckel? |
||
| 21 | |||
| 22 | // app.use("/v1", apiRouter); |
||
| 23 | |||
| 24 | // app.use(errorHandler); |
||
| 25 | |||
| 26 | app.listen(port, () => { |
||
| 27 | console.log(`Server running on port ${port}`); |
||
|
0 ignored issues
–
show
Debugging Code
introduced
by
Loading history...
|
|||
| 28 | }); |
||
| 29 |