1/*
2 This code comes from Vincent Lab
3 And it has a video version linked here: https://www.youtube.com/watch?v=Tw5LupcpKS4
4*/
5
6// Import dependencie
7const express = require("express");
8
9// Setup the express server
10const app = express();
11const port = 3000;
12
13// Import middlewares into express
14app.use(express.json({ limit: "100mb" }));
15
16// Import routes
17const authRouter = require("./routes/auth");
18const messagesRouter = require("./routes/messages");
19
20// Setup all the routes
21app.use("/api/messages", messagesRouter);
22app.use("/api/auth", authRouter);
23
24// Start the server
25app.listen(port, () => {
26 console.log(`Listening on port ${port}...`);
27});