Skip to main content
Glama
app.ts1.09 kB
/** * This is a API server */ import express, { type Request, type Response, type NextFunction, } from 'express' import cors from 'cors' import dotenv from 'dotenv' import authRoutes from './routes/auth.js' // load env dotenv.config() const app: express.Application = express() app.use(cors({ origin: process.env.CORS_ORIGIN ? process.env.CORS_ORIGIN.split(',') : '*' })) app.use(express.json({ limit: '10mb' })) app.use(express.urlencoded({ extended: true, limit: '10mb' })) /** * API Routes */ app.use('/api/auth', authRoutes) /** * health */ app.use( '/api/health', (req: Request, res: Response): void => { res.status(200).json({ success: true, message: 'ok', }) }, ) /** * error handler middleware */ app.use((error: Error, req: Request, res: Response, next: NextFunction) => { res.status(500).json({ success: false, error: 'Server internal error', }) }) /** * 404 handler */ app.use((req: Request, res: Response) => { res.status(404).json({ success: false, error: 'API not found', }) }) export default app

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xwang152-jack/wechat-official-account-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server