-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (41 loc) · 1.23 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
// const express = require('express')
// const fs = require('fs')
// const path = require('path')
// const data = require('./data.json')
// const app = express()
// require('dotenv').config()
// const port = process.env.PORT
// console.log(data);
// app.use(express.static(path.join(__dirname,'project_1')))
// app.use(express.json())
// app.get('/',(req,res)=>{
// res.send('Hello')
// })
// app.post('/login', (req,res)=>{
// let text = ''
// data.forEach(element=>{
// console.log(element)
// if(element.username==req.body.username){
// text += 'username '
// }
// if(element.email==req.body.email){
// text += 'email'
// }
// })
// if(text.length()){
// res.status(400).send({success: false, data: `Please try again ${text} is already taken`})
// }
// const newData = data;
// newData.push(req.body)
// fs.writeFile(path.join(__dirname,'data.json'),JSON.stringify(data),err=>{
// if(err){
// console.log(err);
// return ;
// }
// console.log('data added');
// res.json({success: true});
// })
// })
// app.listen(port,()=>{
// console.log(`server is listening at ${port}`);
// })