Preview:
// this is sometimes named "server.js" as well

import express from "express";
import config from "./config.js";
import apiRouter from "./routes.js";

const app = express();

app.get("/", (_, res) => {
  res.send("Hello World!");
});

app.use("/api", apiRouter);

app.listen(config.port, () => {
  console.log(`Listening on port ${config.port}`);
});
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter