<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Venkat</title>
    <description>The latest articles on DEV Community by Venkat (@venkataswamymedidi).</description>
    <link>https://dev.to/venkataswamymedidi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1044023%2F5fc79e3b-88fa-4464-87bc-aed7a6681fb0.png</url>
      <title>DEV Community: Venkat</title>
      <link>https://dev.to/venkataswamymedidi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/venkataswamymedidi"/>
    <language>en</language>
    <item>
      <title>Is there a way to reslove the build issue while deploying server(nodejs and mongodb) application to heroku</title>
      <dc:creator>Venkat</dc:creator>
      <pubDate>Mon, 13 Mar 2023 05:12:39 +0000</pubDate>
      <link>https://dev.to/venkataswamymedidi/is-there-a-way-to-reslove-the-build-issue-while-deploying-servernodejs-and-mongodb-application-to-heroku-2075</link>
      <guid>https://dev.to/venkataswamymedidi/is-there-a-way-to-reslove-the-build-issue-while-deploying-servernodejs-and-mongodb-application-to-heroku-2075</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;div class="ltag__stackexchange--header"&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7Gn-iPj_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
          &lt;a href="https://stackoverflow.com/questions/75718199/is-there-a-way-to-reslove-the-build-issue-while-deploying-servernodejs-and-mong" rel="noopener noreferrer"&gt;
            Is there a way to reslove the build issue while deploying server(nodejs and mongodb) application to heroku
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Mar 13 '23&lt;/span&gt;
            &lt;span&gt;Comments: 1&lt;/span&gt;
            &lt;span&gt;Answers: 0&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/75718199/is-there-a-way-to-reslove-the-build-issue-while-deploying-servernodejs-and-mong" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y9mJpuJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          0
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wif5Zq3z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;I created a server using Node, Express, and MongoDB Atlas.When i deploy in Heroku backend module is crashing.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;2023-03-13T01:20:41.570961+00:00 heroku\[web.1\]: State changed from crashed to starting
2023-03-13T01:20:42.000000+00:00 app\[api\]: Build succeeded
2023-03-13T01:20:44.228308+00:00 heroku\[web.1\]: Starting process with command `npm start`
2023-03-13T01:20:46.233404+00:00 app\[web.1\]
2023-03-13T01:20:46.233437+00:00 app\[web.1\]: \&amp;gt; server@1.0.0 start
2023-03-13T01:20:46.233438+00:00 app\[web.1\]: \&amp;gt; node src/index.js&lt;/code&gt;&lt;/pre&gt;…
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    &lt;a href="https://stackoverflow.com/questions/75718199/is-there-a-way-to-reslove-the-build-issue-while-deploying-servernodejs-and-mong" class="ltag__stackexchange--btn" rel="noopener noreferrer"&gt;Open Full Question&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Here it's index.js&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// index.js (server)
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const app = express()
const path = require('path')
const apiPort = 3001
const userRouter = require('./route/user')
const recipesRouter = require('./route/recipes')
require('dotenv').config()

const mongoose = require('mongoose')
const db = mongoose.connection

mongoose.connect("mongodb+srv://venkat:&amp;lt;&amp;gt;@recipecluster1.txqo0vw.mongodb.net/recipes?retryWrites=true&amp;amp;w=majority")

app.use(bodyParser.urlencoded({ extended: true }))
app.use(cors())
app.use(bodyParser.json())
app.use("/auth", userRouter)
app.use("/recipes", recipesRouter)

// app.use(express.static(path.join(__dirname, "../../client/build")))

// app.get("*", (res, req) =&amp;gt; {
//     res.sendFile(path.join(__dirname, "../../client/build/index.html"))
// })

app.get('/', (req, res) =&amp;gt; {
    res.send('Server Started!')
})

//app.listen(apiPort, () =&amp;gt; console.log(`Server running on port ${apiPort}`))

app.listen(process.env.PORT || 3001, () =&amp;gt; {
    console.log("Server running on port")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
  </channel>
</rss>
