add project
This commit is contained in:
43
apps/api/src/app.ts
Normal file
43
apps/api/src/app.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import express from 'express';
|
||||
import helmet from 'helmet';
|
||||
import cors from 'cors';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import swaggerUi from 'swagger-ui-express';
|
||||
import { env } from './config/env';
|
||||
import { swaggerSpec } from './config/swagger';
|
||||
import { errorHandler } from './middleware/error-handler';
|
||||
import walletRoutes from './routes/wallet.routes';
|
||||
import relayProxyRoutes from './routes/relay-proxy.routes';
|
||||
import tronProxyRoutes from './routes/tron-proxy.routes';
|
||||
import solSwapProxyRoutes from './routes/sol-swap-proxy.routes';
|
||||
import tronSwapProxyRoutes from './routes/tron-swap-proxy.routes';
|
||||
import btcProxyRoutes from './routes/btc-proxy.routes';
|
||||
import bscSwapProxyRoutes from './routes/bsc-swap-proxy.routes';
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(helmet());
|
||||
app.use(cors({ origin: env.frontendUrl, credentials: true }));
|
||||
app.use(express.json());
|
||||
app.use(cookieParser());
|
||||
|
||||
app.get('/api/health', (_req, res) => {
|
||||
res.json({ success: true, data: { status: 'ok' } });
|
||||
});
|
||||
|
||||
app.use('/api/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
|
||||
app.get('/api/docs/swagger.json', (_req, res) => {
|
||||
res.json(swaggerSpec);
|
||||
});
|
||||
|
||||
app.use('/api/wallets', walletRoutes);
|
||||
app.use('/api/relay', relayProxyRoutes);
|
||||
app.use('/api/tron', tronProxyRoutes);
|
||||
app.use('/api/sol/swap', solSwapProxyRoutes);
|
||||
app.use('/api/tron/swap', tronSwapProxyRoutes);
|
||||
app.use('/api/btc', btcProxyRoutes);
|
||||
app.use('/api/bsc/swap', bscSwapProxyRoutes);
|
||||
|
||||
app.use(errorHandler);
|
||||
|
||||
export default app;
|
||||
Reference in New Issue
Block a user