- Fastify listens on 0.0.0.0:3050 (was 127.0.0.1, blocked nginx proxy) - Remove vite-plugin-vue-devtools (was causing silent page reloads) - Add asciinator.conf with working nginx config (API proxy strips /api/ prefix) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
910 B
JavaScript
35 lines
910 B
JavaScript
import Fastify from 'fastify'
|
|
import multipart from '@fastify/multipart'
|
|
import cors from '@fastify/cors'
|
|
import { convertRoute } from './routes/convert.js'
|
|
import { testRoutes } from './routes/testApi.js'
|
|
|
|
const fastify = Fastify({ logger: { level: 'warn' } })
|
|
|
|
await fastify.register(cors, {
|
|
origin: [
|
|
'http://localhost:5173',
|
|
'http://localhost:4173',
|
|
'https://asciinator.waynehayesdevelopment.com',
|
|
],
|
|
})
|
|
|
|
await fastify.register(multipart, {
|
|
limits: { fileSize: 20 * 1024 * 1024 },
|
|
})
|
|
|
|
await fastify.register(convertRoute)
|
|
|
|
if (process.env.ENABLE_TEST_API === 'true') {
|
|
await fastify.register(testRoutes, { prefix: '/test' })
|
|
console.log('Test API enabled → /test/{health,convert,flags,imagemagick}')
|
|
}
|
|
|
|
try {
|
|
await fastify.listen({ port: 3050, host: '0.0.0.0' })
|
|
console.log('ASCIInator API → http://0.0.0.0:3050')
|
|
} catch (err) {
|
|
fastify.log.error(err)
|
|
process.exit(1)
|
|
}
|