<?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: Shernz</title>
    <description>The latest articles on DEV Community by Shernz (@shernz).</description>
    <link>https://dev.to/shernz</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%2F156369%2Fc97045d9-ced5-4c4d-8fd3-176acd774b2d.jpeg</url>
      <title>DEV Community: Shernz</title>
      <link>https://dev.to/shernz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shernz"/>
    <language>en</language>
    <item>
      <title>Express not reached</title>
      <dc:creator>Shernz</dc:creator>
      <pubDate>Fri, 29 May 2020 01:15:49 +0000</pubDate>
      <link>https://dev.to/shernz/express-not-reached-4200</link>
      <guid>https://dev.to/shernz/express-not-reached-4200</guid>
      <description>&lt;p&gt;Hey guys,&lt;br&gt;
I'm trying to send a post request to the node server but it's not able to reach. Can anyone please help me out as to why this is happening?&lt;br&gt;
This is the code for server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require("express");
const app = express();
const mongoose = require('mongoose');
const port = process.env.PORT || 4000;

require('dotenv').config();
app.use(express.json);

const uri = process.env.ATLAS_URI;
mongoose.connect(uri, {useNewUrlParser: true, useCreateIndex: true});

const connection = mongoose.connection;
connection.once('open', ()=&amp;gt;{
    console.log("Mongo db connected successfully")
});

const postsRouter = require("./routes/posts");

app.use("/posts", postsRouter);

app.listen(port, ()=&amp;gt;{
    console.log(`Connected and listening at port ${port}`)
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And this is for post&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const router = require("express").Router();
let posts = require("../blog.model");

router.route("/").get((req, res) =&amp;gt; {
    posts.find()
    .then (users =&amp;gt; res.json(users))
    .catch (err =&amp;gt; res.status(400).json("Error" + err));
}) 

router.route("/write").post((req, res) =&amp;gt; {
    const title = req.body.title;
    const content = req.body.content;
    const date = new Date();

    const newPost = new posts({title, content, date});

    newPost.save()
    .then(() =&amp;gt; console.log('Post added!'))
    .catch(err =&amp;gt; res.status(400).json("Error" + err));
})
module.exports = router;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AgSAqlac--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t9h9559kukzro5nqktaf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AgSAqlac--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t9h9559kukzro5nqktaf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
  </channel>
</rss>
