forked from EAS-Max/Discord-Bot-API-quotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (25 loc) · 1.05 KB
/
index.js
File metadata and controls
35 lines (25 loc) · 1.05 KB
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
const express = require('express');
let router = express.Router();
const app = express();
app.use(express.json());
const fs = require('fs');
const path = require("path");
const cors = require('cors');
const { init: initDB } = require('./utils/db.js')
initDB()
app.use(cors())
app.use(express.static('public'));
app.use(express.text());
// bot routes
app.get('/api/validate/:command', require('./handlers/bot/validate.js'))
app.get('/api/command/:command', require('./handlers/bot/command.js'))
// ui routes
app.get('/api/quotes', require('./handlers/api/quotes.js').get)
app.post('/api/quotes', require('./handlers/api/quotes.js').post)
app.get('/api/quotes/:id', require('./handlers/api/quotes_id.js').get)
app.get('/api/quotes/person/:person', require('./handlers/api/quotes_person.js').get)
app.get('/api/quotes/random/random', require('./handlers/api/quotes_random.js').get)
app.post('/api/quotes/add', require('./handlers/api/quotes_add.js').post)
var server = app.listen(3000, function () {
console.log('Server running on http://localhost:3000..');
});