mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-26 09:30:27 +01:00
update nodejs
This commit is contained in:
@@ -1,6 +1,45 @@
|
|||||||
import Route from '@ioc:Adonis/Core/Route'
|
import Route from '@ioc:Adonis/Core/Route'
|
||||||
import Application from "@ioc:Adonis/Core/Application";
|
import Application from "@ioc:Adonis/Core/Application";
|
||||||
|
import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
|
||||||
|
import HealthCheck from "@ioc:Adonis/Core/HealthCheck";
|
||||||
|
|
||||||
|
const BASE_URL = "https://api.arthurdanjou.fr"
|
||||||
|
|
||||||
|
Route.get('/', async ({response}: HttpContextContract) => {
|
||||||
|
response.status(200).send({
|
||||||
|
domain: "api.arthurdanjou.fr",
|
||||||
|
version: "1.0",
|
||||||
|
routes: {
|
||||||
|
deezer_data: "",
|
||||||
|
stats_data: "",
|
||||||
|
state_data: `${BASE_URL}/state`,
|
||||||
|
locations_data: "",
|
||||||
|
health: `${BASE_URL}/health`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
Stats : Daily, weekly, monthly (Docker Build & commands, Dev hours)
|
||||||
|
Location: get Last + Add location + View history
|
||||||
|
Deezer Songs:
|
||||||
|
|
||||||
|
Tasks: kernel : setTimeout or cron
|
||||||
|
Dev hours: 5min
|
||||||
|
Deezer songs: 1min
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route.get('/health', async ({ response }) => {
|
||||||
|
const isLive = await HealthCheck.isLive()
|
||||||
|
|
||||||
|
return isLive
|
||||||
|
? response.status(200).send({})
|
||||||
|
: response.status(400).send({})
|
||||||
|
})
|
||||||
|
Route.get('/state', 'StatesController.get')
|
||||||
Route.resource('users', 'UsersController').only(['index', 'show'])
|
Route.resource('users', 'UsersController').only(['index', 'show'])
|
||||||
Route.get('/posts/:slug', 'PostsController.getLikes')
|
Route.get('/posts/:slug', 'PostsController.getLikes')
|
||||||
Route.get('/posts/is/:slug', 'PostsController.isLiked')
|
Route.get('/posts/is/:slug', 'PostsController.isLiked')
|
||||||
@@ -18,6 +57,7 @@ Route.group(() => {
|
|||||||
Route.resource('posts', 'PostsController').only(['store', 'update', 'destroy'])
|
Route.resource('posts', 'PostsController').only(['store', 'update', 'destroy'])
|
||||||
Route.resource('subscribers', 'SubscribersController').only(['store', 'update', 'destroy'])
|
Route.resource('subscribers', 'SubscribersController').only(['store', 'update', 'destroy'])
|
||||||
Route.resource('files', 'FileController').only(['store', 'update', 'destroy'])
|
Route.resource('files', 'FileController').only(['store', 'update', 'destroy'])
|
||||||
|
Route.post('/state', 'StatesController.set')
|
||||||
|
|
||||||
}).middleware('auth')
|
}).middleware('auth')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user