admin管理员组

文章数量:1122832

I'm working on a Node.js API to allow food sellers to upload menu items and associate images with them. I'm using TypeORM for database management and Multer for handling file uploads. However, when testing the API in Postman, the request gets stuck on "Sending Request" indefinitely for the following endpoints.

Technology Stack Database: PostgreSQL ORM: TypeORM (v0.3.20) File Upload Middleware: Multer Framework: Express

import { MenuItem, User } from '../entities';

static async addMenuItem( foodSellerId: number, name: string, price: number, description: string, imageUrl: string ): Promise { const foodSeller = await getRepository(User).findOne({ where: { id: foodSellerId, role: 'foodSeller' } }); if (!foodSeller) throw new Error('Food seller not found');

const menuItem = new MenuItem();
menuItem.name = name;
menuItem.price = price;
menuItem.description = description;
menuItem.imageUrl = imageUrl;
menuItem.foodSeller = foodSeller;

await getRepository(MenuItem).save(menuItem);
return menuItem;

}

POST http://localhost:3000/addMenuItem

Issue When testing both endpoints (/addMenuItem and /uploadImage/:menuItemId) in Postman: The request hangs indefinitely on "Sending Request". No logs are printed to the console. The same issue persists even when using a basic setup for TypeORM and Multer.

What Could Be Causing This? Is there an issue with TypeORM's save or findOne operations when using complex relationships? Could Multer be causing the request to hang during file upload? Are there any specific configurations in TypeORM or Multer that I might be missing? Any insights or suggestions would be greatly appreciated!

本文标签: Postman stuck on 39Sending Request39 for TypeORM and Multer integration in Nodejs APIStack Overflow