-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserve.js
45 lines (34 loc) · 885 Bytes
/
serve.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 app = express()
const dotenv = require('dotenv')
const courses = require('./src/data/courses.json')
const users = require('./src/data/users.json')
dotenv.config()
app.use(express.static('public'))
app.get('/', (req, res) => {
res.sendFile(__dirname + '/index.html')
})
app.get('/detalleProduct', (req, res) => {
res.sendFile(__dirname + '/detalleProducto.html')
})
app.get('/login', (req, res) => {
res.sendFile(__dirname + '/login.html')
})
app.get('/tableUser', (req, res) => {
res.sendFile(__dirname + '/tableUser.html')
})
app.get('/courseVideo', (req, res) => {
res.sendFile(__dirname + '/courseVideo.html')
})
/**
*
* return the json courses
*
*/
app.get('/api/courses', (req, res) => {
res.json(courses)
})
app.get('/api/users', (req, res) => {
res.json(users)
})
app.listen(process.env.PORT)