Added endpoint to query over all visited urls
This commit is contained in:
parent
e8382fb579
commit
bb99c2dcd1
|
@ -267,7 +267,7 @@ fastify.post('/api/auth/register', async (req, res) => {
|
|||
|
||||
//Anything in here has some kind of auth
|
||||
fastify.after(() => {
|
||||
//Get url api route
|
||||
//Get url visits api route
|
||||
fastify.get('/api/:shortcode/visits', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => {
|
||||
const shortcode = req.params.shortcode;
|
||||
|
||||
|
@ -283,6 +283,14 @@ fastify.after(() => {
|
|||
return visits;
|
||||
});
|
||||
|
||||
//Get all visits api route
|
||||
fastify.get('/api/visits', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => {
|
||||
const visits = await knex.select('shortcode','timestamp', 'provider')
|
||||
.from('visits');
|
||||
|
||||
return visits;
|
||||
});
|
||||
|
||||
//Get url api route
|
||||
fastify.delete('/api/:shortcode', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => {
|
||||
const shortcode = req.params.shortcode;
|
||||
|
|
Loading…
Reference in New Issue