I have followed this tutorial (https://www.youtube.com/watch?v=enfZAaTRTKU) on youtube which teaches one how to upload a pdf-file a to an express server and read out its content.
I do not want to display the pdf - I only care about the text.
I have followed the tutorial and it all works for me with the express environment but when I try to do the same with the next.js route handlers it just sends me back a 404 as soon as I call pdfParse()
import pdfParse from 'pdf-parse'
import { NextResponse, type NextRequest } from 'next/server';
export async function POST(request: NextRequest) {
const formData = await request.formData();
const file = formData.get('pdf');
//console.log(file) -- works fine
// causes the server to send a 404
const pdfData = await pdfParse(file)
// it never gets here
return NextResponse.json({"message": "Error"})
}
does anyone know how to deal with this? I would like to avoid having to run a express server just for this.