forked from Kmenelik/regsumar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
55 lines (37 loc) · 1.29 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
require('dotenv').config()
const express = require('express')
const path = require('path')
const http = require('http')
const publicDirectoryPath = path.join(__dirname, '/public')
const port = process.env.PORT || 3001
const app = express()
app.use(express.urlencoded({ extended: true }))
app.use(express.static(__dirname + '/public'))
////--------------------- Local --------------------
// ------------------------ End points -----------------------
app.post('/sumario/create', express.json(), (req, res) => {
})
app.get('/docentes', express.json() ,(req, res) => {
})
// ----------------------- Public file server ----------------
app.get('/', (req, res) => {
res.sendFile(path.join(publicDirectoryPath + '/index.html'))
})
app.get('/user', (req, res) => {
res.sendFile(path.join(publicDirectoryPath + '/user.html'))
})
app.get('/admin', (req, res) => {
res.sendFile(path.join(publicDirectoryPath + '/admin.html'))
})
app.get('/sumario', (req, res) => {
res.sendFile(path.join(publicDirectoryPath + '/createSumario.html'))
})
http.createServer(app).listen(port, () => {
console.log(`Listening on port ${port}`)
})
// create https server
const httpsApp = express()
httpsApp.use(express.urlencoded({ extended: true }))
httpsApp.get('/', (req, res) => {
return res.send('Test: Using HTTPS')
})