mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-27 01:50:26 +01:00
💻 | Working on API
This commit is contained in:
@@ -9,8 +9,7 @@
|
||||
|
|
||||
*/
|
||||
|
||||
import Server from '@ioc:Adonis/Core/Server'
|
||||
|
||||
import Server from "@ioc:Adonis/Core/Server";
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global middleware
|
||||
@@ -20,8 +19,9 @@ import Server from '@ioc:Adonis/Core/Server'
|
||||
| are defined for all HTTP requests.
|
||||
|
|
||||
*/
|
||||
|
||||
Server.middleware.register([
|
||||
'Adonis/Core/BodyParserMiddleware',
|
||||
//'Adonis/Core/BodyParserMiddleware',
|
||||
'App/Middleware/SilentAuth',
|
||||
])
|
||||
|
||||
|
||||
@@ -8,18 +8,16 @@ const BASE_URL = "https://api.arthurdanjou.fr"
|
||||
Route.get('/', async ({response}: HttpContextContract) => {
|
||||
return response.status(200).send({
|
||||
domain: BASE_URL,
|
||||
version: "1.0",
|
||||
version: "2.0",
|
||||
source: `${BASE_URL}/source`,
|
||||
healthCheck: `${BASE_URL}/health`,
|
||||
routes: {
|
||||
arthur_data: `${BASE_URL}/me`,
|
||||
stats_data: `${BASE_URL}/stats`,
|
||||
states_data: `${BASE_URL}/states`,
|
||||
locations_data: `${BASE_URL}/locations`,
|
||||
locations_history: `${BASE_URL}/locations/history`,
|
||||
profile: `${BASE_URL}/profile`,
|
||||
stats: `${BASE_URL}/stats`,
|
||||
states: `${BASE_URL}/states`,
|
||||
locations: `${BASE_URL}/locations`,
|
||||
projects: `${BASE_URL}/projects`
|
||||
},
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -32,19 +30,15 @@ Route.get('health', async ({response}: HttpContextContract) => {
|
||||
return report.healthy ? response.ok(report) : response.badRequest(report)
|
||||
})
|
||||
|
||||
Route.get('/me', 'MeController.me')
|
||||
// ArtAPI
|
||||
Route.get('/profile', 'ProfileController.me')
|
||||
Route.get('/locations', 'LocationsController.get')
|
||||
Route.get('/locations/history', 'LocationsController.history')
|
||||
Route.get('/stats', 'StatsController.get')
|
||||
Route.get('/states', 'StatesController.get')
|
||||
Route.get('/projects', 'ProjectsController.get')
|
||||
Route.resource('users', 'UsersController').only(['index', 'show'])
|
||||
Route.get('/posts/:slug', 'PostsController.getLikes')
|
||||
Route.get('/posts/is/:slug', 'PostsController.isLiked')
|
||||
Route.post('/posts/:slug/like', 'PostsController.like')
|
||||
Route.post('/posts/:slug/unlike', 'PostsController.unlike')
|
||||
Route.resource('subscribers', 'SubscribersController').only(['index', 'show', 'store'])
|
||||
|
||||
Route.resource('users', 'UsersController').only(['index', 'show'])
|
||||
Route.resource('subscribers', 'SubscribersController').only(['index', 'show', 'store'])
|
||||
Route.group(() => {
|
||||
Route.get('/', 'FileController.index')
|
||||
Route.get('/:filename', async ({ response, params }) => {
|
||||
@@ -54,13 +48,9 @@ Route.group(() => {
|
||||
|
||||
Route.group(() => {
|
||||
Route.resource('users', 'UsersController').only(['store', 'update', 'destroy'])
|
||||
Route.resource('posts', 'PostsController').only(['store', 'update', 'destroy'])
|
||||
Route.resource('subscribers', 'SubscribersController').only(['update', 'destroy'])
|
||||
Route.resource('files', 'FileController').only(['store', 'destroy'])
|
||||
Route.post('/states/sleeping', 'StatesController.setSleepingStatus')
|
||||
Route.post('/states/learning', 'StatesController.setLearningStatus')
|
||||
Route.post('/states/developing', 'StatesController.setDevelopingStatus')
|
||||
Route.post('/states/music', 'StatesController.setListeningStatus')
|
||||
Route.post('/states', 'StatesController.set')
|
||||
Route.post('/stats/build', 'StatesController.incrementBuild')
|
||||
Route.post('/stats/command', 'StatesController.incrementCommand')
|
||||
Route.post('/locations', 'LocationsController.add')
|
||||
|
||||
Reference in New Issue
Block a user