-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpress.js
More file actions
42 lines (30 loc) · 809 Bytes
/
express.js
File metadata and controls
42 lines (30 loc) · 809 Bytes
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
const express = require("express");
const path = require("path");
const app = express();
app.use(express.static(__dirname+'/src'))
app.use(express.json())
const data = [];
app.post('/postData/:temp',(req,res)=>{
data.push(req.params.temp)
res.send(data);
})
app.get('/getData',(req,res)=>{
res.json(data);
})
app.get('/',(req,res)=>{
// console.log(req.body)
res.sendFile(__dirname+'/TodoForm.html');
})
app.post('/',(req,res)=>{
console.log(req.query);
res.send("hello")
})
app.get('/addTask',(req,res)=>{
res.sendFile(__dirname+'/TodoList.html');
})
app.get('/newFormat',(req,res)=>{
res.sendFile(__dirname+'/TodoListNewFormat.html');
})
app.listen(3000,()=>{
console.log("listening in 3000");
})