-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathindex.js
88 lines (63 loc) · 1.82 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// const http=require('http');
// const data=require("./data");
// http.createServer((req,res)=>{
// res.writeHead(200,{'Content-type':'application\json'});
// res.write(JSON.stringify(data));
// res.end();
// }).listen(5500);
// const express = require("express");
// const fs=require("fs")
// const path=require("path");
// const dirPath=path.join(__dirname,'files');
// console.log(dirPath)
// for(i=0;i<5;i++)
// {
// fs.writeFileSync(dirPath+"/vivghhhhggek.txt","hello my name is vivek kumar singh");
// }
// let a=10;
// let b=0;
// let wait=new Promise((resolve,reject)=>{
// setTimeout(()=>{
// resolve(30)
// },2000)
// })
// wait.then((data)=>{
// b=data;
// console.log(a+b);
// })
// const express=require('express');
// const app=express();
// const reqFilter=(req,resp,next)=>{
// // console.log("hello");
// if(!req.query.age)
// {
// resp.send("please provide name")
// }
// else if(req.query.age<18){
// resp.send("you are not allowed")
// }
// else{
// next();
// }
// }
// // app.use(reqFilter);
// app.get('/',reqFilter,(res,resp)=>{
// resp.send("welcome to home page")
// });
// app.get('/user',(req,resp)=>{
// resp.send("welcome to user page")
// });
// app.listen(5000)
// console.warn(dbconnect());
// dbconnect().then((resp)=>{
// resp.find().toArray().then((data)=>{
// console.warn(data)
// })
// })
// const dbconnect=require('./mongodb')
// const main =async ()=>{
// let data=await dbconnect();
// data =await data.find().toArray();
// console.warn(data);
// }
// main();