..
Viewing
index.ts
16 lines (12 loc) • 676.0 B
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | import { FastifyRequest, FastifyReply, FastifyInstance, RegisterOptions } from 'fastify';
const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
//await fastify.register(getcomics, { prefix: '/getcomics' });
fastify.get('/', async (request: FastifyRequest, reply: FastifyReply) => {
reply.status(200).send('Welcome to Consumet Comics 🦸♂️');
});
fastify.get('/s', async (request: FastifyRequest, reply: FastifyReply) => {
const { comicTitle, page } = request.query as { comicTitle: string; page: number };
reply.status(300).redirect(`getcomics/s?comicTitle=${comicTitle}&page=${page}`);
});
};
export default routes;
|
|