Promise Chaining in nodejs

python async promise nodejs 5 years, 3 months ago
const mul = (a, b) => { return new Promise((resolve, reject)=> { setTimeout(()=>{ resolve(a*b) }, 5000) }) } mul(1,2).then((multiply)=>{ return mul(multiply, 4) }).then((res)=>{ console.log(res); }).catch((e)=>{ console.log(e); })
1133
Posted By
How to use callbacks in node js
//add.js
const add = (p1, p2, callback) => {
setTimeout(()=>{
nodejs javascript async callback
harika
https requests and callbacks in nodejs
//ex.js
const https = require('https')
const url = "" //Use the url you want to
nodejs callback javascript http https
harika
Create webserver using expressjs
//server.js
const express = require("express")
const app = express()
nodejs route javascript expressjs
harika
How to serve static pages using expressjs
//app.js
const path = require("path");
const express = require("express")
nodejs javascript path expressjs static pages
harika
Write a basic promise in nodejs
const mul = (a, b) => {
  return new Promise((resolve, reject)=>
    setTimeout(()=>{
nodejs async javascript promise
harika
How to use async-await with promises in nodej
const mul = (a, b) => {
  return new Promise((resolve, reject)=>
    setTimeout(()=>{
nodejs javascript async await promise
harika
How to Connect to a mongodb database using mo
const {MongoClient, ObjectID} = require(
const ConnectionURL = "mongodb://127.0.0
const DBName = "koder-mongo-app";
nodejs javascript nodemon mongodb
harika
How to Connect to a mongodb database using mo
const mongoose = require("mongoose");
mongoose.connect("mongodb://127.0.0.1:27
  useNewUrlParser: true,
nodejs mongoose javascript nodemon mondodb
harika
Python Script to create AWS beanstalk
#!/usr/bin/python
  
import boto
python aws beanstalk
sandeep sandeep
List all files and folders using python os mo
import os

def list_files_folders(path):
python python-os
kishore_kumar
Get current environment variables in python
import os
env = os.environ

python python-os
kishore_kumar
Get os details using python os
import os
print os.uname()
# Don't use os.system('uname -a'), its j
python python-os
kishore_kumar
Get stats ( lines, words, char count ) of fil
def file_stats(path):
    f = open(path, 'r')
    lines = f.readlines()
python
kishore_kumar
Use map function in python
def get_double(num):
    return num * 2

python
kishore_kumar
Python sample codes for beginners
print "Welcome to python"
python
gaya38 gaya38
Python program for even number checking
a=input("Enter a value:")
if (a%2==0):
    print "The given number is even numb
python
gaya38 gaya38
Python program for prime number check
a=input("Enter a value:")
k=0
b=(a/2)+1
python
gaya38 gaya38
Pass command line arguments in python
import sys
x=len(sys.argv)
a=[]
python
gaya38 gaya38
Python program for the largest number in an a
a = [1,43,98,5]#Dummy data
for l in range(len(a)-1):
        if (a[l]>a[l+1]):
python
gaya38 gaya38
print list of even numbers within a range
n=100
a=[10,20,30,40,50]
b=[60,70,80,90]
python
gaya38 gaya38