0

So not sure why but I am trying to submit my form data to /api/new

But when I do I get the following error

./pages/api/new.js
Error: 
  x Expected '(', got 'new'
   ,----
 2 | export default function new(req, res) {
   :                         ^^^
   `----

Caused by:
    0: failed to process input file
    1: Syntax Error

Not sure why but seems to only be an issue when I have inputs that are file type.

1 Answer 1

1

new is a reserved keyword and you cannot use reserved keywords as function, variable, label, or class names. Try naming the handler newRouteHandler or something else.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.