express get query params from url
GET /something?color1=red&color2=blue
app.get('/something', (req, res) => {
req.query.color1 === 'red' // true
req.query.color2 === 'blue' // true
})var express = require('express');
var app = express();
app.get('/', function(req, res){
res.send('id: ' + req.query.id);
});
app.listen(3000);// GET /search?q=tobi+ferret
console.dir(req.query.q)
// => 'tobi ferret'
// GET /shoes?order=desc&shoe[color]=blue&shoe[type]=converse
console.dir(req.query.order)
// => 'desc'
console.dir(req.query.shoe.color)
// => 'blue'
console.dir(req.query.shoe.type)
// => 'converse'
// GET /shoes?color[]=blue&color[]=black&color[]=red
console.dir(req.query.color)
// => ['blue', 'black', 'red']
Also in JavaScript:
- node lodash documentation
- create a form and submit it dynamically jquery
- use callback vs use memo
- javascript localStorage clear items
- javascript do not submit form
- mysql json_extract remove quotes
- jquery scroll to top of div animate
- find class
- recorrer letra por letra js
- adonis andwhere
- how to use javascript to get full file path
- ejs / javascript check if array/object exists and is not empty
- javascript capitalize
- get page link angular
- Javascript get element height and width
- javascript array get nth element
- how to insert a value into an array javascript
- string immutable javascript
- what are the two ways to create an array in javascript examples?
- set localstorage
- modulo operator in javascript
- reactjs cut part of string
- antiforgerytoken mvc with ajax
- Elements in iteration expect to have 'v-bind:key' directives