Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const router = express.Router();
- "use strict";
- const nodemailer =require('nodemailer');
- const smtpTransport = nodemailer.createTransport( {
- host: 'smtp.gmail.com',
- port: 587,
- secure: false,
- auth: {
- user: "projetpfb@gmail.com",
- pass:""
- }
- });
- /* GET home page. */
- router.get('/', function(req, res, next) {
- res.render('index', { title: 'Express' });
- });
- router.use('/superMiddleware', function(req, res, next){
- console.log('hello middleware');
- next();
- }, function (req,res,next) {
- res.send('hello world');
- next();
- });
- router.use('/askForCookiesRecipe', function(req, res, next){
- smtpTransport.sendMail({
- from:"Deer wild <deer@wild.com>",
- to: "supergrandma@yopmail.com",
- subject: "Coucou",
- text: "Salut Mami c'est quoi la recette des zezettes de Sete? Tu peux l'envoyer? CIMER! ",
- html: "<b> Cookie click generator </b>"
- }, (error, response) => {
- if(error){
- console.log(error);
- }else{
- console.log("Message sent:" + response.response);
- }
- });
- next();
- });
- module.exports = router;
Add Comment
Please, Sign In to add comment