react18-tools/turborepo-template

View on GitHub
examples/express/src/server.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { json, urlencoded } from "body-parser";
import express, { type Express } from "express";
import morgan from "morgan";
import cors from "cors";

/** Create express server. */
export const createServer = (): Express => {
  const app = express();
  app
    .disable("x-powered-by")
    .use(morgan("dev"))
    .use(urlencoded({ extended: true }))
    .use(json())
    .use(cors())
    // @ts-ignore
    .get("/message/:name", (req, res) => {
      return res.json({ message: `hello ${req.params.name}` });
    })
    // @ts-ignore
    .get("/status", (_, res) => {
      return res.json({ ok: true });
    });

  return app;
};