-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Elimine todo el historial de git para asegurarme de que no hayan cont…
…raseñas expuestas
- Loading branch information
Showing
134 changed files
with
8,707 additions
and
8,332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
name: Deploy app Digital Ocean | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: self-hosted | ||
|
||
strategy: | ||
matrix: | ||
node-version: [22.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm i | ||
- run: npm run build --if-present | ||
# - name: Install doctl | ||
# uses: digitalocean/action-doctl@v2 | ||
# with: | ||
# token: ${{ secrets.DO_TOKEN }} | ||
# - name: Set up SSH | ||
# run: | | ||
# eval "$(ssh-agent -s)" | ||
# ssh-add - < "${{ secrets.SSH_PRIVATE_KEY }}" | ||
# - name: Deploy to Droplet | ||
# run: | | ||
# ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@${{secrets.IP_PUBLICA}} | ||
# cd ./var/www/html/Vue | ||
# git pull | ||
# npm install | ||
# pm2 restart app.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# web | ||
|
||
Sitio web oficial de SugarCoach Diabetes Premium | ||
## Project setup | ||
``` | ||
npm install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
apps : [{ | ||
name : "sugar-web-api", | ||
script : "index.js", | ||
watch : true, | ||
max_memory_restart: '1000M' | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
require('dotenv').config() | ||
console.log("Iniciado") | ||
async function startServer() { | ||
try { | ||
const port = process.env.PORT || 8080 | ||
const user = process.env.USER | ||
const pass = process.env.PASS | ||
const nodemailer = require('nodemailer') | ||
const cors = require('cors') | ||
const express = require('express') | ||
const app = express() | ||
app.use(express.urlencoded({extended: false})) | ||
app.use(express.json()) | ||
// Middleware para CORS | ||
app.use(cors({ | ||
origin: ['https://sugar.coach', 'http://localhost:8081'], | ||
methods: ['POST'], | ||
allowedHeaders: ['Content-Type', 'Authorization'], | ||
credentials: true | ||
})) | ||
// POST METHOD API URL | ||
app.get('/', (req, res) => { | ||
res.send("Funciona!!") | ||
}) | ||
app.post('/submit', (req, res) => { | ||
const {username, email} = req.body | ||
const transporter = nodemailer.createTransport({ | ||
service: 'gmail', | ||
auth: { | ||
user: user, | ||
pass: pass | ||
} | ||
}); | ||
|
||
const mailOptions = { | ||
from: user, | ||
to: user, // Aquí pones la dirección a la que quieres enviar el correo | ||
subject: `Cuenta borrada: ${username}` , | ||
text: `Nombre: ${username}, Email: ${email}` | ||
}; | ||
transporter.sendMail(mailOptions, (error, info) => { | ||
if (error) { | ||
console.log(error); | ||
} else { | ||
console.log('Email enviado: ' + info.response); | ||
} | ||
}); | ||
|
||
res.send( `\nreq.body:\n${username} ${email}`) | ||
// res.json({ | ||
// message: 'Formulario enviado correctamente' }); | ||
|
||
}) | ||
|
||
app.listen(port, () => { | ||
console.log(`Servidor escuchando en el puerto ${port}`); | ||
}); | ||
}catch (err) { | ||
console.error(error); | ||
} | ||
} | ||
startServer() | ||
// const nodemailer = require('nodemailer'); | ||
// const path = require('path'); | ||
|
||
// Configura Express para poder recibir datos de formularios | ||
// app.use(express.urlencoded({ extended: false })); | ||
// app.use(require('./routes/index')); | ||
// app.use(express.static(path.join(__dirname, 'views'))); | ||
|
||
|
||
// Ruta para procesar el formulario | ||
// app.post('/submit', (req, res) => { | ||
|
||
// | ||
// }); |
Oops, something went wrong.