Last active
July 16, 2023 21:44
-
-
Save jonathans199/537a01e85648c31132cd3d96813ab081 to your computer and use it in GitHub Desktop.
Node Express API deployed to Vercel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
const express = require('express') | |
const app = express() | |
const PORT = 4000 | |
app.listen(PORT, () => { | |
console.log(`API listening on PORT ${PORT} `) | |
}) | |
app.get('/', (req, res) => { | |
res.send('Hey this is my API running 🥳') | |
}) | |
app.get('/about', (req, res) => { | |
res.send('This is my about route..... ') | |
}) | |
// Export the Express API | |
module.exports = app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 2, | |
"builds": [ | |
{ | |
"src": "index.js", | |
"use": "@now/node" | |
} | |
], | |
"routes": [ | |
{ | |
"src": "/(.*)", | |
"dest": "index.js" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment