What's the easiest way to deploy a basic API endpoint to Vercel?
I made an Express app structured like:
api |--- index.jspackage.jsonpnpm-lock.yamlvercel.json
api |--- index.jspackage.jsonpnpm-lock.yamlvercel.json
api/index.js:
import express from 'express'import cors from 'cors'const app = express()// Disable CORS rulesapp.use(cors())app.get('/', (req, res) => { res.send('It works!')})const PORT = process.env.PORT || 3000app.listen(PORT, () => { console.log(`API listening on PORT ${PORT} `)})export default app
import express from 'express'import cors from 'cors'const app = express()// Disable CORS rulesapp.use(cors())app.get('/', (req, res) => { res.send('It works!')})const PORT = process.env.PORT || 3000app.listen(PORT, () => { console.log(`API listening on PORT ${PORT} `)})export default app
The API just uploads files to S3 or GCS, so I'm open to using any other language or framework. It will mainly be used in my T3 app, but I found Next.js really confusing with handling files (tried to use HTML form, formidable, multer, ...)