NODE-JS
1. it is backend technology
2. used to develop server side apps
3. we develop node-js apps with the help of javascript
4. it supports libraries or modules
5. we will download libraries/modules with the help of either npm or yarn
libraries:-
1. Express-JS:-express library used to develop restAPIs.
2. mongoDB:- this library used to connect to mongoDB database
3. cors:- this library used to enable cors policy
NODE-JS
Step1:- create the folder for backend
Step2:- download libraries (yarn add express mongodb cors)
if not npm init
Step3:- create server.js file
//import modules
//require is the function used to import modules
const express = require("express");
const mongodb = require("ongodb");
const cors = require("cors");
//create rest object to do Get post put delete
//rest obj used to develop restAPIs
const app =express();
//where app is the rest object
//while working with network we use to prefer JSON
app.use(express.json());
//enable cors policy
app.use(cors());
// to interact with MongoDB database we have to create client object
//by using client object only we can interact with MongoDB database
const client = mongodb.MongoClient;
// create get request
app.get(`/products`, (req,res)=>{
client.connect(`url`,(err,connection)=>{
if(err) throw err;
else{
const db = connection.db("AmanRash");
db.connection("products").find().toArray((err,array)=>{
if(err) throw err;
else{res.json(array);
}
})
}
});
});
1. it is backend technology
2. used to develop server side apps
3. we develop node-js apps with the help of javascript
4. it supports libraries or modules
5. we will download libraries/modules with the help of either npm or yarn
libraries:-
1. Express-JS:-express library used to develop restAPIs.
2. mongoDB:- this library used to connect to mongoDB database
3. cors:- this library used to enable cors policy
NODE-JS
Step1:- create the folder for backend
Step2:- download libraries (yarn add express mongodb cors)
if not npm init
Step3:- create server.js file
//import modules
//require is the function used to import modules
const express = require("express");
const mongodb = require("ongodb");
const cors = require("cors");
//create rest object to do Get post put delete
//rest obj used to develop restAPIs
const app =express();
//where app is the rest object
//while working with network we use to prefer JSON
app.use(express.json());
//enable cors policy
app.use(cors());
// to interact with MongoDB database we have to create client object
//by using client object only we can interact with MongoDB database
const client = mongodb.MongoClient;
// create get request
app.get(`/products`, (req,res)=>{
client.connect(`url`,(err,connection)=>{
if(err) throw err;
else{
const db = connection.db("AmanRash");
db.connection("products").find().toArray((err,array)=>{
if(err) throw err;
else{res.json(array);
}
})
}
});
});
app.post("/Insert, (req, res)
client.connect mongodbery://adi:adingbatch, fgquksongodb.net/?
retrylerites-trunjority,(err,connection)
if(err) throw err;
else
const db connection.db"database");
db.collection("products")("id", body a body.o_name," cost" req. body a cost)
if(err) throw err:
else
res.json((message: "record Inserted successfully":
client.connect mongodbery://adi:adingbatch, fgquksongodb.net/?
retrylerites-trunjority,(err,connection)
if(err) throw err;
else
const db connection.db"database");
db.collection("products")("id", body a body.o_name," cost" req. body a cost)
if(err) throw err:
else
res.json((message: "record Inserted successfully":
Java Hyd Team
December 11 ๐๐
Conducting for 3hour only will explain how to program and one question of last session (what's the real-time implementation of abstract classes ). 10am -1 pm
Java Hyd Team
https://forms.gle/h4bqyzQtGqUk3LR6A FILL THIS FORM FOR TOMMORROWS MASTERCLASS TIMINGS 10AM-3PM WE WILL COVER EVERYTHING FROM SCRATCH TO ADVANCE LEVEL
Fill this form to get meeting link n access
Next Sunday again we will be covering core java, advance java, Spring and spring boot , React-Js
Java Hyd Team pinned ยซNext Sunday again we will be covering core java, advance java, Spring and spring boot , React-Jsยป
Java Hyd Team
Conducting for 3hour only will explain how to program and one question of last session (what's the real-time implementation of abstract classes ). 10am -1 pm
Will try to cover everything but be available as we will cover things fast in-depth
public static void main(String[] args) {
double a ,b ;
a= System.currentTimeMillis();
List<Double> list = of(1, 1000000000).boxed().collect(Collectors.toList());
list.forEach(obj -> System.out.print(obj));
b=System.currentTimeMillis();
System.out.println(b-a);
}
}
double a ,b ;
a= System.currentTimeMillis();
List<Double> list = of(1, 1000000000).boxed().collect(Collectors.toList());
list.forEach(obj -> System.out.print(obj));
b=System.currentTimeMillis();
System.out.println(b-a);
}
}
๐1
package com.Aman;import java.util.List;import java.util.stream.Collectors;import java.util.stream.IntStream;import java.util.stream.LongStream;import static java.lang.System.currentTimeMillis;import static java.util.stream.DoubleStream.of;public class Billions { /* public static void main(String[] args) { double n=0; do{ System.out.println(n); n+=1; }while(n<100000000); }*/ // public static void main(String[] args) { /*double a ,b ; a= currentTimeMillis(); List<Double> list = of(1, 1000000000).boxed().toList(); list.forEach(System.out::println); b= currentTimeMillis(); System.out.println(b-a); }*/ /* public static void main(String[] args) { double a ,b ; a= currentTimeMillis(); // Using Java 8 Stream API to print 1 billion numbers IntStream.range(1, 1000000000).forEach(System.out::println); b= currentTimeMillis(); System.out.println(b-a); }}*///} public static void main(String[] args) { long count = IntStream.rangeClosed(1,1000000000).parallel().count(); System.out.println(count); }}import java.util.*;public class _7_12_2022 { public static void main(String[] args) { String a = "sathyaa"; Map<Character, Integer> m = new HashMap<>(); for(int i = 0; i < a.length(); i++){ if(m.containsKey(a.charAt(i))){ m.put(a.charAt(i), m.get(a.charAt(i))+1); } else { m.put(a.charAt(i), 1); } } System.out.println(m.toString()); /*String s = "aabbcbabadchisidb"; Map<Character, Integer> m = new HashMap<>(); for(int i = 0; i < s.length(); i++){ if(m.containsKey(s.charAt(i))){ m.put(s.charAt(i), m.get(s.charAt(i))+1); } else { m.put(s.charAt(i), 1); } } Collection<Integer> a = m.values(); int max = Collections.max(a); for(Character ch : m.keySet()){ if(m.get(ch)==max){ System.out.println(ch+"-"+m.get(ch)); } }*/ }}๐1