Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
How do I run an API endpoint deployed to Vercel? (not using Next.js)

I've got a bit of a weird set up here with a codebase that I inherited. It's a CRA app deployed to Vercel but doesn't use Next.js.

Problem: I'm not able to call myapp.com/nonce from Postman or access it in my browser to see the JSON response. There's some configuration stuff that's not quite right, just trying to figure out what that is. Would love any help here!

I have a file structure that looks like this:

Project (create-react-app)
   src
     bunch of React code
   server
     index.js
     package.json
   package.json

(It's not using next.js. If it were, I'd just use the /pages/api/* files)

In my top-level package.json, I have:

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build && cd server && npm install && npm run start",
}

and in my /server/package.json I have just a simple start command: node index.js

My server/index.js file:

const path = require('path');
const express = require("express");
const PORT = process.env.PORT || 3001;
const app = express();

app.use(express.static(path.resolve(__dirname, '../MyProject/build')));


app.get('/nonce', async (req, res) => {
  const { address } = req.query;
  const quantity = snapshot[address];

  return res.json({ quantity, address }); // for testing 
})

Edit:

With this as-is, my build phase never actually completes.. It runs a server at 3001 and that's the last log of the Build log

> MyProject-server@0.1.0 start /vercel/path0/server
> node index.js
Server listening on 3001
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!