first commit
This commit is contained in:
commit
3c0479faf0
169 files changed
+27617
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { existsSync } from 'node:fs'
|
||||
import app from '@adonisjs/core/services/app'
|
||||
import type { HttpContext } from '@adonisjs/core/http'
|
||||
|
||||
/**
|
||||
* Serves the Angular application for every URL that is neither a file
|
||||
* of "public/" nor an API route (/containers, /projects/…).
|
||||
*/
|
||||
export default class SpaController {
|
||||
async index({ request, response }: HttpContext) {
|
||||
if (request.url().startsWith('/api/')) {
|
||||
return response.notFound({ message: 'Route inconnue.' })
|
||||
}
|
||||
|
||||
const index = app.publicPath('index.html')
|
||||
if (!existsSync(index)) {
|
||||
return response.notFound(
|
||||
'Interface non compilée : lance "npm run build" dans web/ (ou "npm start" pour le développement).'
|
||||
)
|
||||
}
|
||||
|
||||
response.header('Cache-Control', 'no-cache')
|
||||
return response.download(index)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user