Create webserver using expressjs

expressjs route javascript nodejs 4 years, 6 months ago
//server.js const express = require("express") const app = express() const port = 3000 app.get('/', (req, res) => res.send('Welcome to Koderplace')) app.listen(port, () => console.log(`Example app listening on port ${port}!`))
1317
Instructions

Prerequisites : express suppose to be installed
If not try npm i express inside the project folder, where the package.json resides
node server.js
try to load the url "localhost:3000"

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
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
Promise Chaining in nodejs
const mul = (a, b) => {
  return new Promise((resolve, reject)=>
    setTimeout(()=>{
nodejs python async 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
Work with inline styles in React js
//plugin to any test js file and proceed
//This is the best standard to work with
const style = {background:'cyan', color:
javascript react js css
harika
Work with 3rd party css libraries in react fr
import React from 'react'
//No need to give the complete path, rea
//If not exists searches globally
javascript react js
harika
work with react without node installation in
//Basic way
<!DOCTYPE html>
<html>
javascript react js html
harika
Difference between state and stateless compon
//State Component
<!DOCTYPE html>
<html>
javascript react js
harika
Create a React app without webpack and Create
//Basic way
<!DOCTYPE html>
<html>
javascript react js webpack
harika
JQuery toggle functionality in react
import React from 'react'
export default class ToggleComponent ext
  constructor(props){
javascript react js
harika
display state inside any html tag
import React from 'react'
export default class StateProps extends 

javascript react js
harika
Import any class irrespective of default expo
import React, { Component } from 'react'
javascript react js
harika
Run Java script code Synchronously inside a f
async function showAvatar() {

  // read our JSON
javascript
harika
Run shell files in javascript
//JS Code
function runShellScript(){
    const process = require('child_proce
javascript shell node js
harika
XHR Request & Ajax Request
//Fill
javascript
harika
Pass Data/Properties from child to parent in
//Parent.js
import React from "react";
import Child from './Child'
javascript react js
harika