-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
49 lines (41 loc) · 1.08 KB
/
Copy pathindex.js
File metadata and controls
49 lines (41 loc) · 1.08 KB
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
import express from 'express'
import logger from './middlewares/logger.middleware.js'
import taskRoutes from './routes/task.routes.js'
const app = express()
app.use(express.urlencoded())
app.use(logger)
app.use('', taskRoutes)
const PORT = 3000
app.get('/', (req, res) => {
res.json({
name: 'Task Manager App',
time: new Date().toLocaleString()
})
})
app.listen(PORT, () => {
console.log(`Task Manager server is running on http://localhost:${PORT}`)
})
/*
# Task Manager RESTful APIS
1. GET /tasks (READ all tasks) ✅
2. GET /tasks/:id (READ specific task) ✅
3. POST /tasks (CREATE task) ✅
4. PATCH /tasks/:id (Update task) ✅
5. DELETE /tasks/:id (Delete task) ✅
# Folders
1. routes ***:
- task.routes.js
- user.routes.js
- post.routes.js
2. controllers ***:
- task.controller.js
- user.controller.js
- post.controller.js
3. models (Related to Database) ***:
- task.model.js
- user.model.js
- post.model.js
4. middlewares:
- logger.middleware.js
- validator.middleware.js
*/