main.js
const {app, BrowserWindow} = require('electron');  let mainWindow = null; app.on('ready', () => {   mainWindow = new BrowserWindow();   mainWindow.webContents.loadURL(`file://${__dirname}/index.html`); });

index.html
<!DOCTYPE html> <html lang="en"> <head>   <meta charset="UTF-8">   <meta name="viewport" content="width=device-width,initial-scale=1">   <title>Restos</title>   <style>     body {       font-family: Helvetica;       margin: 25px;     }   </style> </head> <body>   <h1>Application Restos</h1> </body> </html>

<!DOCTYPE html> <html lang="en"> <head>   <meta charset="UTF-8">   <meta name="viewport" content="width=device-width,initial-scale=1">   <title>Restos</title>   <style>     body {       font-family: Helvetica;       margin: 25px;     }   </style> </head> <body>   <h1>Application Restos</h1>   <input id="txtKeyWords" type="search" placeholder="mots clés"/>   <input id="txtKeyCity" type="search" placeholder="ville"/>   <button>Chercher</button>   <hr>    <div id="results"></div>    <script>      require('./renderer');   </script>  </body> </html>

const Yelp = require('yelp'); const Mustache = require('mustache');  const yelp = new Yelp({   consumer_key: 'consumer-key',   consumer_secret: 'consumer-secret',   token: 'token',   token_secret: 'token-secret', });  const btnSearch = document.querySelector('button'); const txtKeyWords = document.querySelector('#txtKeyWords'); const txtKeyCity = document.querySelector('#txtKeyCity'); const results = document.querySelector('#results');  let template = ` {{#businesses}}   {{name}} - {{display_phone}}<br>   {{#location.display_address}}     {{.}}<br>   {{/location.display_address}}   <br>   <img class="photo-box-img" height="90" width="90" src="{{image_url}}"/>   <hr> {{/businesses}} `;  btnSearch.addEventListener('click', () => {   yelp.search({ term: `resto ${txtKeyWords.value}`, location: `${txtKeyCity.value}, France` })   .then(data => {     let rendered = Mustache.render(template, data);     results.innerHTML = rendered;     console.log(data);   })   .catch(err => {     console.error(err);   }); });

const {app, ipcMain, BrowserWindow} = require('electron');  let mainWindow = null; app.on('ready', () => {   mainWindow = new BrowserWindow();   mainWindow.webContents.loadURL(`file://${__dirname}/index.html`); });  ipcMain.on('close-main-window', (event, arg) => {   app.quit(); });

const Yelp = require('yelp'); const Mustache = require('mustache');  // modules pour l'envoi de messages et la construction du menu const {ipcRenderer, remote} = require('electron'); const {Menu, MenuItem} = remote;  const yelp = new Yelp({   consumer_key: '0u2wBtwB7DbNJLM9Us-RKg',   consumer_secret: '0j5F8BhVZoruFsBFWDK026zAE1w',   token: 'hXXYVzZep8ABRRPL50SZxxGylvkYEFGp',   token_secret: 'Ud_UkbKhshGO_2f5EOBu58q5hCU', });  const btnSearch = document.querySelector('button'); const txtKeyWords = document.querySelector('#txtKeyWords'); const txtKeyCity = document.querySelector('#txtKeyCity'); const results = document.querySelector('#results');  let template = ` {{#businesses}}   {{name}} - {{display_phone}}<br>   {{#location.display_address}}     {{.}}<br>   {{/location.display_address}}   <br>   <img class="photo-box-img" height="90" width="90" src="{{image_url}}"/>   <hr> {{/businesses}} `;  // définition du menu let menuTemplate = [   {     label: "Restos",     submenu:[       {         label: 'Quit',         accelerator: 'Command+Q',         click: function() { ipcRenderer.send('close-main-window'); }       }     ]   } ];  let menu = Menu.buildFromTemplate(menuTemplate); Menu.setApplicationMenu(menu);  btnSearch.addEventListener('click', () => {   yelp.search({ term: `resto ${txtKeyWords.value}`, location: `${txtKeyCity.value}, France` })   .then(data => {     let rendered = Mustache.render(template, data);     results.innerHTML = rendered;     console.log(data);   })   .catch(err => {     console.error(err);   }); });