forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
37 lines (25 loc) · 786 Bytes
/
app.js
File metadata and controls
37 lines (25 loc) · 786 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
'use strict'
const path = require('path')
const Static = require('fastify-static')
const Cors = require('fastify-cors')
const { getData } = require('./connectKube');
module.exports = function (fastify, opts, next) {
fastify.register(Cors, {
origin: true
})
fastify.register(Static, {
root: path.join(__dirname, 'frontend/build'),
wildcard: false
});
fastify.get('/*', function(req, reply) {
reply.sendFile('index.html');
});
fastify.get('/api/components', function (req, reply) {
getData();
//console.log(data)
reply.sendFile('odhDataRes.json');
fastify.get('/api/components', function (req, reply) {
reply.sendFile('odhDataRes.json')
})
next()
}