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
版权声明:本文标题:Postman stuck on 'Sending Request' for TypeORM and Multer integration in Node.js API - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305175a1932497.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论