<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
>

<channel>
	<title>nodemon - Bipon's Diary</title>
	<atom:link href="https://biponnotes.iglyphic.com/tag/nodemon/feed/" rel="self" type="application/rss+xml" />
	<link>https://biponnotes.iglyphic.com</link>
	<description>Do good for others. It will come back in unexpected ways.</description>
	<lastBuildDate>Sun, 26 Jan 2020 06:28:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.10</generator>
<site xmlns="com-wordpress:feed-additions:1">168324471</site>	<item>
		<title>Data read from an array</title>
		<link>https://biponnotes.iglyphic.com/date-read-from-an-array/</link>
					<comments>https://biponnotes.iglyphic.com/date-read-from-an-array/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Sat, 18 Jan 2020 08:28:03 +0000</pubDate>
				<category><![CDATA[Node]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[nodemon]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=382</guid>

					<description><![CDATA[<p>prerequisite software node, express, npm, yarn, or any code editor Step 1: create a folder like node-api in desktop or any location in your computer Step 2: open VS Editor &#62; Terminal (keyboard command : Ctrl + ~) then run yarn init . Create a package.json file Step 3: create a index.js file into node-api&#8230;<a href="https://biponnotes.iglyphic.com/date-read-from-an-array/" class="more-link">Continue reading <span class="screen-reader-text">Data read from an array</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/date-read-from-an-array/">Data read from an array</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>prerequisite software</strong></p>



<p><code>node, express, npm, yarn, or any code editor</code></p>



<p>Step 1: create a folder like <code>node-api</code> in desktop or any location in your computer</p>



<p>Step 2: open VS Editor &gt; Terminal (keyboard command : Ctrl + ~)</p>



<p>then run <code>yarn init</code> . Create a <code>package.json</code> file</p>



<pre class="wp-block-code"><code>{
  "name": "node-api",
  "version": "1.0.0",
  "license": "MIT",
}</code></pre>



<p>Step 3: create a <code>index.js</code> file into <code>node-api</code> folder</p>



<pre class="wp-block-code"><code>const express = require('express');
const app = express();

app.get('/', (req, res) => {
    res.send('I am from Node JS!!')
})

//server creation
app.listen(4000, () =>{
    console.log('server created and listening port 4000')
})</code></pre>



<p>Step 4: install <code>nodemon npm</code> plugin for auto run server</p>



<p>update <code>package.json</code> file</p>



<pre class="wp-block-code"><code>{
  "name": "node-api",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "start": "node index",
    "dev": "nodemon index"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}</code></pre>



<figure class="wp-block-image"><img width="813" height="247" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/01/node.png?resize=813%2C247&#038;ssl=1" alt="" class="wp-image-374" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/node.png?w=813&amp;ssl=1 813w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/node.png?resize=300%2C91&amp;ssl=1 300w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/node.png?resize=768%2C233&amp;ssl=1 768w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/node.png?resize=750%2C228&amp;ssl=1 750w" sizes="(max-width: 813px) 100vw, 813px" data-recalc-dims="1" /></figure>



<p>More on request and response <code>index.js</code></p>



<pre class="wp-block-code"><code>const express = require('express');
const app = express();

app.get('/', (req, res) => {
    console.log(req.url)
    res.send('I am from Node JS!!')
})
app.get('/hello', (req, res)=>{
    res.send('Hello bipon')
})
//server creation
app.listen(4000, () =>{
    console.log('server creted and listening port 4000')
})</code></pre>



<p>As a  response  by object</p>



<pre class="wp-block-code"><code>app.get('/', (req, res) => {
    console.log(req.url)
    const author = {
        name: "bipon",
        profession: 'front end developer'
    }
    //JSON.stringify(author)
    res.send(author)
})</code></pre>



<p>Variable path in Routing</p>



<pre class="wp-block-code"><code>app.get('/hello/:name', (req, res)=>{
    const name = req.params.name;
    res.send(`Hello ${name}`)
})</code></pre>



<p>If don&#8217;t get any valid url then showing <code>404 Not Found</code></p>



<pre class="wp-block-code"><code>app.get('*', (req, res) => {
    res.send('404 Not Found')
})</code></pre>



<p>Now data read from an <code>array</code>. so create a new array. Update bellow <code>code</code>.</p>



<pre class="wp-block-code"><code>let notes = [
    {
        id: 1,
        name: 'Note title 1',
        description: 'Note description 1'
    },
    {
        id: 2,
        name: 'Note title 2',
        description: 'Note description 2'
    },
    {
        id: 3,
        name: 'Note title 3',
        description: 'Note description 3'
    }
]</code></pre>



<pre class="wp-block-code"><code>// get all notes
app.get('/notes', (req, res) => {
    if(notes.length == 0){
        return res.status(404).send('Note Not Found.')
    }else{
        res.send(notes)
    }
})
//get single note
app.get('/notes/:noteId', (req, res) => {
    const noteId = parseInt(req.params.noteId);
    const note = notes.find(note => note.id === noteId);
    if(note){
        res.send(note);
    }else{
        res.status(404).send('Note Not Found');
    }
})</code></pre>



<p>Reference: <a href="https://httpstatuses.com/">status</a></p><p>The post <a href="https://biponnotes.iglyphic.com/date-read-from-an-array/">Data read from an array</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/date-read-from-an-array/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">382</post-id>	</item>
		<item>
		<title>Create your first NODE server</title>
		<link>https://biponnotes.iglyphic.com/create-your-first-node-server/</link>
					<comments>https://biponnotes.iglyphic.com/create-your-first-node-server/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Sat, 18 Jan 2020 06:17:57 +0000</pubDate>
				<category><![CDATA[Node]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[nodemon]]></category>
		<category><![CDATA[yarn]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=373</guid>

					<description><![CDATA[<p>prerequisite software node, express, npm, yarn, or any code editor Step 1: create a folder like node-api in desktop or any location in your computer Step 2: open VS Editor > Terminal (keyboard command : Ctrl + ~) then run yarn init . Create a package.json file Step 3: create a index.js file into node-api&#8230;<a href="https://biponnotes.iglyphic.com/create-your-first-node-server/" class="more-link">Continue reading <span class="screen-reader-text">Create your first NODE server</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/create-your-first-node-server/">Create your first NODE server</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p> <strong>prerequisite software</strong></p>



<p><code>node, express, npm, yarn, or any code editor</code></p>



<p>Step 1: create a folder like <code>node-api</code> in desktop or any location in your computer</p>



<p>Step 2: open VS Editor > Terminal (keyboard command : Ctrl + ~)</p>



<p>then run <code>yarn init</code> . Create a <code>package.json</code> file</p>



<pre class="wp-block-code"><code>{
  "name": "node-api",
  "version": "1.0.0",
  "license": "MIT",
}</code></pre>



<p>Step 3: create a <code>index.js</code> file into <code>node-api</code> folder</p>



<pre class="wp-block-code"><code>const express = require('express');
const app = express();

app.get('/', (req, res) => {
    res.send('I am from Node JS!!')
})

//server creation
app.listen(4000, () =>{
    console.log('server created and listening port 4000')
})</code></pre>



<p>Step 4: install <code>nodemon npm</code> plugin for auto run server</p>



<p>update <code>package.json</code> file</p>



<pre class="wp-block-code"><code>{
  "name": "node-api",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "start": "node index",
    "dev": "nodemon index"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}</code></pre>



<figure class="wp-block-image"><img loading="lazy" width="813" height="247" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/01/node.png?resize=813%2C247&#038;ssl=1" alt="" class="wp-image-374" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/node.png?w=813&amp;ssl=1 813w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/node.png?resize=300%2C91&amp;ssl=1 300w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/node.png?resize=768%2C233&amp;ssl=1 768w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/node.png?resize=750%2C228&amp;ssl=1 750w" sizes="(max-width: 813px) 100vw, 813px" data-recalc-dims="1" /></figure>



<p>More on request and response <code>index.js</code></p>



<pre class="wp-block-code"><code>const express = require('express');
const app = express();

app.get('/', (req, res) => {
    console.log(req.url)
    res.send('I am from Node JS!!')
})
app.get('/hello', (req, res)=>{
    console.log(req.url);
    res.send('Hello bipon')
})

//server creation
app.listen(4000, () =>{
    console.log('server creted and listening port 4000')
})</code></pre>



<p>As a  response  by object</p>



<pre class="wp-block-code"><code>app.get('/', (req, res) => {
    console.log(req.url)
    const author = {
        name: "bipon",
        profession: 'front end developer'
    }
    //JSON.stringify(author)
    res.send(author)
})</code></pre>



<p>Variable path in Routing</p>



<pre class="wp-block-code"><code>app.get('/hello/:name', (req, res)=>{
    const name = req.params.name;
    res.send(`Hello ${name}`)
})</code></pre>



<p>If don&#8217;t get any valid url then showing <code>404 Not Found</code></p>



<pre class="wp-block-code"><code>app.get('*', (req, res) => {
    res.send('404 Not Found')
})</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/create-your-first-node-server/">Create your first NODE server</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/create-your-first-node-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">373</post-id>	</item>
	</channel>
</rss>
