-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
38 lines (28 loc) · 963 Bytes
/
app.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
const express = require('express');
const SetController = require('./controllers/SetController');
const CardController = require('./controllers/CardController');
const path = require('path');
const app = express();
app.use(express.static('public'));
app.get("/sets", async function(request, response) {
const controller = new SetController();
const data = await controller.getAll();
response.send(data);
});
app.get("/cards", async function(request, response) {
const controller = new CardController();
const data = await controller.getAll(request.query);
response.send(data);
});
app.get('/types', async function(request, response) {
const controller = new CardController();
const data = await controller.getCardTypes();
response.send(data);
});
app.get('/builder', function(req, res) {
res.sendFile(path.join(__dirname, '/views/builder.html'));
});
app.get('/ping', function(req, res) {
res.send("I'm alive ! >:)")
});
module.exports = app;