Criar somente a automação backend em Node.js para integrar Hotmart → Webhook → Banco → Fluxos de e-mail e status, para uso dentro da minha plataforma já existente Zeyra (não criar frontend, sistema, telas nem painel).
848f927 verified Download src/server.js from fernandosliborioo/hotmartflow-integrator: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/fernandosliborioo/hotmartflow-integrator/resolve/main/src/server.js
- Command line
-
hf download hf://spaces/fernandosliborioo/hotmartflow-integrator/src/server.js
-
curl -L -o server.js https://huggingface.co/spaces/fernandosliborioo/hotmartflow-integrator/resolve/main/src/server.js
1.11 kB
| require('dotenv').config(); | |
| const express = require('express'); | |
| const cors = require('cors'); | |
| const { PrismaClient } = require('@prisma/client'); | |
| const authRoutes = require('./routes/auth'); | |
| const webhookRoutes = require('./routes/webhook'); | |
| const prisma = new PrismaClient(); | |
| const app = express(); | |
| // Middleware | |
| app.use(cors()); | |
| app.use(express.json()); | |
| app.use(express.urlencoded({ extended: true })); | |
| // Routes | |
| app.use('/api/auth', authRoutes); | |
| app.use('/api/webhook', webhookRoutes); | |
| // Health check | |
| app.get('/health', (req, res) => { | |
| res.status(200).json({ status: 'OK', timestamp: new Date().toISOString() }); | |
| }); | |
| // Error handling middleware | |
| app.use((err, req, res, next) => { | |
| console.error(err.stack); | |
| res.status(500).json({ error: 'Something went wrong!' }); | |
| }); | |
| // 404 handler | |
| app.use('*', (req, res) => { | |
| res.status(404).json({ error: 'Route not found' }); | |
| }); | |
| const PORT = process.env.PORT || 3000; | |
| app.listen(PORT, () => { | |
| console.log(`🚀 Server running on port ${PORT}`); | |
| console.log(`📊 Environment: ${process.env.NODE_ENV || 'development'}`); | |
| }); | |
| module.exports = app; |