diff --git a/server.js b/server.js index f053d94..e1e71f4 100644 --- a/server.js +++ b/server.js @@ -9,11 +9,12 @@ const surveyController = require('./controllers/surveyController'); const responseController = require('./controllers/responseController'); var app = express(); app.use(bodyParser.json()) -app.listen(3000, () => { +const port = process.env.PORT || 3000; +app.listen(port, () => { console.log('Express server started at port: 3000'); }); app.use(cors()); app.use('/user', userController); app.use('/survey', surveyController); app.use('/response', responseController); - \ No newline at end of file +app.get('/', (req, res) => res.send('Home Page Route')); \ No newline at end of file diff --git a/vercel.json b/vercel.json index dd877e4..81de7e5 100644 --- a/vercel.json +++ b/vercel.json @@ -3,5 +3,17 @@ "version": 2, "env": { "MONGODB_URI": "@my-mongodb-uri" - } + }, + "builds": [ + { + "src": "./server.js", + "use": "@vercel/node" + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "/" + } + ] } \ No newline at end of file