forked from GEOLYTIX/xyz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
express.js
65 lines (32 loc) · 1.82 KB
/
express.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
55
56
57
58
59
60
61
62
63
64
65
require('dotenv').config()
const express = require('express')
const cookieParser = require('cookie-parser')
const app = express()
app.use('/xyz', express.static('docs', {
extensions: ['html']
}))
app.use(`${process.env.DIR || ''}/public`, express.static('public'))
app.use(process.env.DIR || '', express.static('public'))
app.use(`${process.env.DIR || ''}/tests`, express.static('tests'))
app.use(process.env.DIR || '', express.static('tests'))
app.use(cookieParser())
const api = require('./api/api')
app.get(`${process.env.DIR || ''}/api/provider/:provider?`, api)
app.post(`${process.env.DIR || ''}/api/provider/:provider?`, express.json({ limit: '5mb' }), api)
app.get(`${process.env.DIR || ''}/api/sign/:provider?`, api)
app.post(`${process.env.DIR || ''}/api/sign/:provider?`, express.json({ limit: '5mb' }), api)
app.get(`${process.env.DIR || ''}/api/query/:template?`, api)
app.post(`${process.env.DIR || ''}/api/query/:template?`, express.json({ limit: '5mb' }), api)
app.get(`${process.env.DIR || ''}/api/fetch/:template?`, api)
app.post(`${process.env.DIR || ''}/api/fetch/:template?`, express.json({ limit: '5mb' }), api)
app.get(`${process.env.DIR || ''}/api/workspace/:key?`, api)
app.get(`${process.env.DIR || ''}/api/user/:method?/:key?`, api)
app.post(`${process.env.DIR || ''}/api/user/:method?`, [express.urlencoded({ extended: true }), express.json({ limit: '5mb' })], api)
app.get(`${process.env.DIR || ''}/saml/metadata`, api)
app.get(`${process.env.DIR || ''}/saml/logout`, api)
app.get(`${process.env.DIR || ''}/saml/login`, api)
app.post(`${process.env.DIR || ''}/saml/acs`, express.urlencoded({ extended: true }), api)
app.get(`${process.env.DIR || ''}/view/:template?`, api)
app.get(`${process.env.DIR || ''}/:locale?`, api)
process.env.DIR && app.get(`/`, api)
app.listen(process.env.PORT || 3000)