Javascript Code Samples



Filters


Create a simple web server with express using Node js
kishore_kumar | 5 years, 7 months
const express = require('express')

const app = express()
express javascript node js
Create a model and save document in Mongo db using Mongoose and Node JS
kishore_kumar | 5 years, 7 months
const mongoose = require("mongoose")

mongoose.connect("mongodb://127.0.0.1:27017/my-db", {
mongoose javascript node js
Load native javascript inside webview in react-native
harika | 4 years, 10 months
import React, { Component } from 'react';
import {View,  WebView} from 'react-native-webview';

install react-native-webview using npm npm i react-native-webview --save try to load the compo
html react-native webview
How to use async-await with promises in nodejs
harika | 5 years, 2 months
const mul = (a, b) => {
  return new Promise((resolve, reject)=> {
    setTimeout(()=>{
nodejs javascript async
Connect to Mongo DB and insert documents in Node JS
kishore_kumar | 5 years, 7 months
const mongodb = require("mongodb")
const mongo_client = mongodb.MongoClient

javascript node js mongodb
Dynamic templating using express and handlebars
harika | 5 years, 2 months
//app.js
const path = require("path");
const express = require("express")
express dynamic templating javascript
How to Connect to a mongodb database using mongodb in nodejs
harika | 5 years, 2 months
const {MongoClient, ObjectID} = require("mongodb");
const ConnectionURL = "mongodb://127.0.0.1:2701
nodejs javascript nodemon
Run shell files in javascript
harika | 6 years, 5 months
//JS Code
function runShellScript(){
    const process = require('child_process'); 
keep the function code inside the js file wherever you want to use. and keep the shell file provided
javascript shell node js
Compress files synchronously in javascript
harika | 6 years
const tar = require('tar');
  tar.c(
    {
try to install 'tar' using npm and then try. Happy Coding :-)
node js javascript react js
Load html inside webview using react native
harika | 4 years, 10 months
// html.js
module.exports = function() { return `
<html>
Install react-native-webview using npm npm i react-native-webview --save try to seperate th
html react-native webview
Prev Next