Skip to content

No Docker Support, Missing Global Error Middleware, Bad Folder Structure #329

@Maheshghosh

Description

@Maheshghosh
  1. use this
    FROM node:20-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

EXPOSE 5000

CMD ["npm", "start"]

  1. FIX THE SECOND PROBLEM
    export const errorHandler = (
    err,
    req,
    res,
    next
    ) => {
    console.error(err);

res.status(err.status || 500).json({
success: false,
message: err.message || "Internal Server Error",
});
};

  1. Change to moderate structure

    Modern Structure
    src/
    ├── api/
    │ ├── controllers/
    │ ├── services/
    │ ├── routes/
    │ └── middlewares/

    ├── config/
    ├── database/
    ├── modules/
    │ ├── github/
    │ ├── auth/
    │ └── analytics/

    ├── utils/
    ├── types/
    └── app.ts

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions