Nodejs Code Samples



Filters


Create webserver using expressjs
harika | 1 year, 7 months
//server.js
const express = require("express")
const app = express()
Prerequisites : express suppose to be installed If not try npm i express inside the project folde
nodejs route javascript
How to use async-await with promises in nodejs
harika | 1 year, 6 months
const mul = (a, b) => {
  return new Promise((resolve, reject)=> {
    setTimeout(()=>{
nodejs javascript async
How to Connect to a mongodb database using mongoose in nodejs
harika | 1 year, 6 months
const mongoose = require("mongoose");
mongoose.connect("mongodb://127.0.0.1:27018/koder-mongo-app",
nodejs mongoose javascript
How to Connect to a mongodb database using mongodb in nodejs
harika | 1 year, 6 months
const {MongoClient, ObjectID} = require("mongodb");
const ConnectionURL = "mongodb://127.0.0.1:2701
nodejs javascript nodemon
How to use callbacks in node js
harika | 1 year, 7 months
//add.js
const add = (p1, p2, callback) => {
setTimeout(()=>{
try to run the file with node Ex: node add.js
nodejs javascript async
Promise Chaining in nodejs
harika | 1 year, 6 months
const mul = (a, b) => {
  return new Promise((resolve, reject)=> {
    setTimeout(()=>{
nodejs python async
Write a basic promise in nodejs
harika | 1 year, 6 months
const mul = (a, b) => {
  return new Promise((resolve, reject)=> {
    setTimeout(()=>{
nodejs async javascript
https requests and callbacks in nodejs
harika | 1 year, 7 months
//ex.js
const https = require('https')
const url = "" //Use the url you want to get the data from
try to run the file with the help of node node ex.js
nodejs callback javascript
How to serve static pages using expressjs
harika | 1 year, 7 months
//app.js
const path = require("path");
const express = require("express")
the app.js and index.html suppose to be in the same directory. try to run nodemon app.js, you can s
nodejs javascript path