Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

express api make

const express = require('express')
const app = express()
const port = 3000

app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.get('/users/name', (req, res) => {// users/name?name=Alex
  return res.send(
    `How are you ${req.query.name} !`,
  ); // How are you Alex
}); 

app.get('/users/:userId', (req, res) => {// users/Alex
  return res.send(
    `How are you ${req.params.name} !`,
  );// How are you Alex
});

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
})
Comment

express api

app.render('email', function (err, html) {
  // ...
})

app.render('email', { name: 'Tobi' }, function (err, html) {
  // ...
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: Javascript looping through table 
Javascript :: if variable does not exist javascript 
Javascript :: input change event in javascript 
Javascript :: java superscript numbers 
Javascript :: npm json server 
Javascript :: remove border on modal material ui 
Javascript :: js get file content from url 
Javascript :: select tag event listener 
Javascript :: dont trigger useeffect on start 
Javascript :: document selector query change value 
Javascript :: node js util promisify 
Javascript :: download image jquery onclick 
Javascript :: nodejs express return image 
Javascript :: update an item in array of object 
Javascript :: drupal 8 get node from path alias 
Javascript :: how to right rotate an array in JS 
Javascript :: discord js send dm to user 
Javascript :: httpget javascript 
Javascript :: vuex v-model 
Javascript :: between in mongodb 
Javascript :: ajax authorization header token 
Javascript :: iframe player youtube onfinish event 
Javascript :: validate age javascript 
Javascript :: push state array react 
Javascript :: summation of array elements 
Javascript :: how to copy text in js 
Javascript :: Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5 
Javascript :: mongodb filter empty array 
Javascript :: link to another page and achor 
Javascript :: javascript clone array of objects 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =