Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

create express js project

$ npx express-generator
Comment

Setting up an Express project

mkdir api-project
cd api-project
npm init 
npm install express --save
Comment

setting up Express

npm init  => give name,description
npm i express
//create app.js
const express = require('express')
const app = express()
//create route
app.get('/',(req,res)=> {
//res.status(200).send("Hello from server side.")
 res.json({message:"Hello from the server side"}) //passing json.
})

app.post('/',(req,res)=> {
res.send("You can post to this endpoint..")
})
//start server
const port = 3000
app.listen(port,()=> {
console.log(`App running on port ${port}...`)
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to give data from react native to webview 
Javascript :: string filter javascript 
Javascript :: return then javascript 
Javascript :: splice javascript 
Javascript :: ng-lazyload-image 
Javascript :: react-bootstrap problem-import new version 
Javascript :: how to use hammerjs in ionic 5 
Javascript :: react axios POST using async await method with super constructor parent class 
Javascript :: practice javascript 
Javascript :: jsx map with index 
Javascript :: remove array value by index js 
Javascript :: will console.log will be automatically disabled in react native for development build 
Javascript :: esbuild 
Javascript :: Using a decrementing For Loop to Reverse an Array 
Javascript :: javascript find area of triangle 
Javascript :: compare if strings are equal javascript 
Javascript :: phaser3 align text center 
Javascript :: js closure 
Javascript :: how to prevent render in react 
Javascript :: expo cli vs react native cli 
Javascript :: js addeventlistener input searcb mobile 
Javascript :: react rating stars component 
Javascript :: javascript set() handler 
Javascript :: create angular app with routing 
Javascript :: node check text include in file 
Javascript :: to do list app react code 
Javascript :: javascript Sum of all the factors of a number 
Javascript :: chess.js 
Javascript :: exchange value between 2 items in array javascript 
Javascript :: app running in expo client is slow 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =