Files
WaifuBoard/src/views/views.routes.js

47 lines
1.8 KiB
JavaScript

const fs = require('fs');
const path = require('path');
async function viewsRoutes(fastify, options) {
fastify.get('/', (req, reply) => {
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'index.html'));
reply.type('text/html').send(stream);
});
fastify.get('/books', (req, reply) => {
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'books.html'));
reply.type('text/html').send(stream);
});
fastify.get('/anime/:id', (req, reply) => {
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'anime.html'));
reply.type('text/html').send(stream);
});
fastify.get('/anime/:extension/*', (req, reply) => {
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'anime.html'));
reply.type('text/html').send(stream);
});
fastify.get('/watch/:id/:episode', (req, reply) => {
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'watch.html'));
reply.type('text/html').send(stream);
});
fastify.get('/book/:id', (req, reply) => {
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'book.html'));
reply.type('text/html').send(stream);
});
fastify.get('/book/:extension/*', (req, reply) => {
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'book.html'));
reply.type('text/html').send(stream);
});
fastify.get('/read/:provider/:chapter/*', (req, reply) => {
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'read.html'));
reply.type('text/html').send(stream);
});
}
module.exports = viewsRoutes;