Skip to content

Commit

Permalink
middleware without Ejs
Browse files Browse the repository at this point in the history
  • Loading branch information
codingXpert committed Jul 7, 2022
1 parent d85dfd3 commit 180d1a4
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 0 deletions.
29 changes: 29 additions & 0 deletions middleware2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const express = require("express");
const app = express()

// Creating First Middleware
app.use("/", (req, res, next) => {
if(req.query.age == 10)
res.send("<h1>Hello</h1>");

// The next() function called
else
next();
})

// Creating second middleware
app.get("/", (req, res, next) => {
res.send(`
<h1>Get Request</h1>
<style>
h1{
color:red
}
</style>
`)
})

// Execution the server
app.listen(8000, () => {
console.log("Server is Running")
})
129 changes: 129 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"http": "^0.0.1-security",
"i": "^0.3.7",
"nodemon": "^2.0.18",
"react-toastify": "^9.0.5",
"to": "^0.2.9",
"update": "^0.7.4"
},
Expand Down
17 changes: 17 additions & 0 deletions react-hot -toast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//import React from 'react';

import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

function App(){
const notify = () => toast("Wow so easy!");

return (
<div>
<button onClick={notify}>Notify!</button>


<ToastContainer />
</div>
);
}

0 comments on commit 180d1a4

Please sign in to comment.