Update via Query Parameter – Nodejs Tutorial 5
Update via Query Parameter – Nodejs Tutorial 5
Source Code
// updating data using query parameter
// import express
const express = require(“express”)
// new app
const app = express()
// new fruits array
fruits=[]
// new route for
app.get(“/:index”, (req,res)=>{
// add query parameter
// let update our fruits array
fruits.push(req.params.index)
// lets show data to end user
res.send(fruits)
})
// listen and serve
app.listen(8080)