mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
Update to v5
This commit is contained in:
@@ -21,8 +21,8 @@ import Server from "@ioc:Adonis/Core/Server";
|
||||
*/
|
||||
|
||||
Server.middleware.register([
|
||||
'Adonis/Core/BodyParserMiddleware',
|
||||
'App/Middleware/SilentAuth',
|
||||
() => import('@ioc:Adonis/Core/BodyParser'),
|
||||
() => import('App/Middleware/SilentAuth'),
|
||||
])
|
||||
|
||||
/*
|
||||
@@ -42,5 +42,5 @@ Server.middleware.register([
|
||||
|
|
||||
*/
|
||||
Server.middleware.registerNamed({
|
||||
auth: 'App/Middleware/Auth',
|
||||
auth: () => import('App/Middleware/Auth'),
|
||||
})
|
||||
|
||||
@@ -2,18 +2,19 @@ import Route from '@ioc:Adonis/Core/Route'
|
||||
import Application from "@ioc:Adonis/Core/Application";
|
||||
import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
|
||||
import HealthCheck from "@ioc:Adonis/Core/HealthCheck";
|
||||
import Env from '@ioc:Adonis/Core/Env'
|
||||
|
||||
const BASE_URL = "https://api.arthurdanjou.fr"
|
||||
const BASE_URL = Env.get('BASE_URL')
|
||||
|
||||
Route.get('/', async ({response}: HttpContextContract) => {
|
||||
return response.status(200).send({
|
||||
domain: BASE_URL,
|
||||
version: "2.0",
|
||||
version: Env.get('API_VERSION'),
|
||||
source: `${BASE_URL}/source`,
|
||||
healthCheck: `${BASE_URL}/health`,
|
||||
routes: {
|
||||
profile: `${BASE_URL}/profile`,
|
||||
stats: `${BASE_URL}/stats`,
|
||||
//stats: `${BASE_URL}/stats`,
|
||||
states: `${BASE_URL}/states`,
|
||||
locations: `${BASE_URL}/locations`,
|
||||
projects: `${BASE_URL}/projects`
|
||||
@@ -22,7 +23,7 @@ Route.get('/', async ({response}: HttpContextContract) => {
|
||||
})
|
||||
|
||||
Route.get('/source', async ({response}: HttpContextContract) => {
|
||||
return response.redirect('https://github.com/arthurdanjou/artapi')
|
||||
return response.redirect(Env.get('GITHUB_SOURCE'))
|
||||
})
|
||||
|
||||
Route.get('health', async ({response}: HttpContextContract) => {
|
||||
@@ -35,7 +36,7 @@ Route.get('health', async ({response}: HttpContextContract) => {
|
||||
// ArtAPI
|
||||
Route.get('/profile', 'ProfileController.me')
|
||||
Route.get('/locations', 'LocationsController.get')
|
||||
Route.get('/stats', 'StatsController.get')
|
||||
//Route.get('/stats', 'StatsController.get')
|
||||
Route.get('/states', 'StatesController.get')
|
||||
Route.get('/projects', 'ProjectsController.get')
|
||||
|
||||
@@ -57,9 +58,6 @@ Route.group(() => {
|
||||
Route.group(() => {
|
||||
// ArtAPI
|
||||
Route.post('form', 'FormsController.send')
|
||||
Route.post('/states/:state', 'StatesController.set')
|
||||
Route.post('/stats/build', 'StatesController.incrementBuild')
|
||||
Route.post('/stats/command', 'StatesController.incrementCommand')
|
||||
// ArtSite
|
||||
Route.group(() => {
|
||||
Route.get('/:slug', 'PostsController.getLikes')
|
||||
|
||||
Reference in New Issue
Block a user