<?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: shubhammishra107</title>
    <description>The latest articles on DEV Community by shubhammishra107 (@shubhammishra107).</description>
    <link>https://dev.to/shubhammishra107</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%2F1095840%2Fec36052d-01c5-43fe-a3b1-5a6849cbe926.png</url>
      <title>DEV Community: shubhammishra107</title>
      <link>https://dev.to/shubhammishra107</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shubhammishra107"/>
    <language>en</language>
    <item>
      <title>How many way we can create server for Http1 and Http2 node js</title>
      <dc:creator>shubhammishra107</dc:creator>
      <pubDate>Thu, 29 Jun 2023 13:52:44 +0000</pubDate>
      <link>https://dev.to/shubhammishra107/how-many-way-we-can-create-server-for-http1-and-http2-node-js-2a9f</link>
      <guid>https://dev.to/shubhammishra107/how-many-way-we-can-create-server-for-http1-and-http2-node-js-2a9f</guid>
      <description>&lt;p&gt;In this Article, we will learn how to create a simple Node.js web server and handle HTTP  and Http2 requests.&lt;br&gt;
Node.js is an open-source and cross-platform JavaScript runtime environment. It is most  popular tool for almost any kind of project like web and static as well report generation UI .&lt;br&gt;
Node.js runs the V8 JavaScript engine, the core of Google Chrome, outside of the browser. This allows Node.js to be very performant.&lt;/p&gt;

&lt;p&gt;To follow along with this tutorial - the reader will need the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A basic knowledge of JavaScript programming is essential.&lt;/li&gt;
&lt;li&gt;Having basic  idea of Node.js installed on your machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Following are way to create  Server in node js &lt;/p&gt;

&lt;h2&gt;
  
  
  1) Creating Server using ‘http‘ Module:
&lt;/h2&gt;

&lt;p&gt;Import http module: Import http module and store returned HTTP instance into a variable.&lt;/p&gt;

&lt;p&gt;var express = require('express');&lt;br&gt;
var path = require('path');&lt;br&gt;
var netjet = require('netjet');&lt;br&gt;
const root = path.join(__dirname, '/public')&lt;br&gt;
const app = express()&lt;/p&gt;

&lt;p&gt;app.set('views', path.join(__dirname, 'view'));&lt;br&gt;&lt;br&gt;
app.set('view engine', 'ejs')&lt;/p&gt;

&lt;p&gt;app.get("/", async (req, res) =&amp;gt; {&lt;br&gt;
  res.render("index")&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;app&lt;br&gt;
  .use(netjet({&lt;br&gt;
    cache: {&lt;br&gt;
      max: 100&lt;br&gt;
    }&lt;br&gt;
  }))&lt;br&gt;
  .use(express.static(root))&lt;br&gt;
  .listen(3008);&lt;/p&gt;

&lt;h2&gt;
  
  
  2) Creating Server using ‘http2‘ Module:
&lt;/h2&gt;

&lt;p&gt;Import http module: Import http module and store returned HTTP2 instance into a variable.&lt;/p&gt;

&lt;p&gt;const http2Express = require('http2-express-bridge')&lt;br&gt;
const http2 = require('http2')&lt;br&gt;
const { readFileSync } = require('fs')&lt;br&gt;
const express = require("express")&lt;br&gt;
const fs = require("fs")&lt;br&gt;
var path = require('path');&lt;br&gt;
var cors= require('cors')&lt;/p&gt;

&lt;p&gt;const app = http2Express(express)&lt;br&gt;
const bodyParser = require("body-parser");&lt;br&gt;
app.use(cors());&lt;br&gt;
app.use(bodyParser.json());&lt;br&gt;
app.use(bodyParser.urlencoded({extended : true}));&lt;/p&gt;

&lt;p&gt;const PUBLIC_PATH = path.join(__dirname, '/public')&lt;/p&gt;

&lt;p&gt;app.use(express.static("public"))&lt;br&gt;
app.set('views', path.join(__dirname, 'view'));&lt;br&gt;&lt;br&gt;
app.set('view engine', 'ejs')&lt;/p&gt;

&lt;p&gt;const options = {&lt;br&gt;
     key: fs.readFileSync("./server.key"),&lt;br&gt;
    cert: fs.readFileSync("./server.crt")&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;app.get('/', function (req, res) {&lt;br&gt;
  res.render('index')&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;const server = http2.createSecureServer(options,app)&lt;br&gt;
server.listen(3000, () =&amp;gt; {&lt;br&gt;
        console.log(&lt;code&gt;listening on port 3000&lt;/code&gt;)&lt;br&gt;
})&lt;/p&gt;

&lt;h2&gt;
  
  
  3) Creating Server using ‘http2‘ Module:
&lt;/h2&gt;

&lt;p&gt;Import http module: Import http module and store returned spdy instance into a variable.&lt;/p&gt;

&lt;p&gt;const spdy = require("spdy")&lt;br&gt;
const express = require("express")&lt;br&gt;
const fs = require("fs")&lt;br&gt;
const {promisify} = require("util")&lt;br&gt;
var netjet = require('netjet');&lt;br&gt;
var path = require('path');&lt;br&gt;
const app = express()&lt;br&gt;
app.use(netjet({&lt;br&gt;
  cache:{max:100}&lt;br&gt;
}))&lt;br&gt;
app.use(express.static("public"))&lt;br&gt;
app.set('views', path.join(__dirname, 'view'));&lt;br&gt;&lt;br&gt;
app.set('view engine', 'ejs')&lt;/p&gt;

&lt;p&gt;app.get("/", async (req, res) =&amp;gt; {&lt;br&gt;
res.render("index")&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;spdy.createServer(&lt;br&gt;
  {&lt;br&gt;
    key: fs.readFileSync("./server.key"),&lt;br&gt;
    cert: fs.readFileSync("./server.crt"),&lt;br&gt;
  spdy: {&lt;br&gt;
    plain: false,&lt;br&gt;
    protocols: [ 'h2', 'spdy/3.1','spdy/2','spdy/3', 'http/1.1' ],&lt;br&gt;
    'x-forwarded-for': true&lt;br&gt;
  }&lt;br&gt;
  }&lt;br&gt;
  ,&lt;br&gt;
  app&lt;/p&gt;

&lt;p&gt;).listen(3000, (err) =&amp;gt; {&lt;br&gt;
  if(err){&lt;br&gt;
    throw new Error(err)&lt;br&gt;
  }&lt;br&gt;
  console.log("Listening on port 3000")&lt;br&gt;
})&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Here we learn about different ways in nodejs .&lt;br&gt;
We import module like http , http2 and spdy  to create server.&lt;br&gt;
Now, run your web server using node app.js. Visit &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt; and you will see a message saying "Hello World".&lt;br&gt;
Refer to the Introduction to Node.js for a more comprehensive guide to getting started with Node.js.&lt;/p&gt;

&lt;p&gt;More Examples&lt;br&gt;
See &lt;a href="https://github.com/nodejs/examples"&gt;https://github.com/nodejs/examples&lt;/a&gt; for a list of Node.js examples that go beyond hello world.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Exponentiation operator in js</title>
      <dc:creator>shubhammishra107</dc:creator>
      <pubDate>Sun, 04 Jun 2023 18:30:00 +0000</pubDate>
      <link>https://dev.to/shubhammishra107/exponentiation-operator-in-js-4n64</link>
      <guid>https://dev.to/shubhammishra107/exponentiation-operator-in-js-4n64</guid>
      <description>&lt;h1&gt;
  
  
  exponentiation in javascipt, #exponentiation symbol , #operator #arithmetic operator #javascipt
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Exponentiation  operator in javascript
&lt;/h2&gt;

&lt;p&gt;The result of increasing the first operand to the power of the second operand is returned by the exponentiation (**) operator.&lt;/p&gt;

&lt;p&gt;•    The exponentiation operator (**) raises the first operand to the power of the second operand.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
let x = 5;&lt;br&gt;
let z = x ** 2;&lt;/p&gt;

&lt;p&gt;o/p= 5sq=25&lt;/p&gt;

&lt;p&gt;•    x ** y produces the same result as Math.pow(x,y):&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
      let x = 5;&lt;br&gt;
      let z = Math.pow(x,2);&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;/p&gt;

&lt;p&gt;There has been rapid development and changes in information technology plateform. so javascript is tranding in market .We  write article on exponentiation  operator  and there is many operator like   Arithmetic Operators; Assignment Operators; Comparison Operators; String Operators; Logical Operators .see you in next topic of javascript .If you feel any doubt and query  please connect on social medium patform on below in bottom. &lt;/p&gt;

&lt;h1&gt;
  
  
  find below List of different operator in Javascript
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;    JS Arithmetic Operators&lt;/li&gt;
&lt;li&gt;    JS Assignment Operators&lt;/li&gt;
&lt;li&gt;    JS Comparison Operators&lt;/li&gt;
&lt;li&gt;    JS Logical Operators&lt;/li&gt;
&lt;li&gt;    JS Ternary Operators&lt;/li&gt;
&lt;li&gt;    JS Bitwise Operators&lt;/li&gt;
&lt;li&gt;    JS typeof Operator&lt;/li&gt;
&lt;/ul&gt;

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