Skip to content
Extraits de code Groupes Projets
Vérifiée Valider e0545167 rédigé par Sting's avatar Sting Validation de Kubat
Parcourir les fichiers

CLIENT: Add basic express router app

parent f8a2ecfc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
2 requêtes de fusion!3Dev kubat,!1Create basic lib
...@@ -3,15 +3,11 @@ ...@@ -3,15 +3,11 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Lektor App</title> <title>Lektor App</title>
<!-- https://electronjs.org/docs/tutorial/security#csp-meta-tag -->
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link rel="stylesheet" href="../style/bootstrap-4.5.2-dist/css/bootstrap.min.css"> <link rel="stylesheet" href="../style/bootstrap-4.5.2-dist/css/bootstrap.min.css">
<script src="../style/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script>
<!-- main file running the express app -->
<script src='./main.js' type='text/javascript'></script>
</head> </head>
<body> <body>
<!-- main file running the express app -->
<script src='./main.js' type='text/javascript'></script>
</body> </body>
</html> </html>
\ No newline at end of file
const express = require('express');
const app = express();
const port = 3000;
console.log('Express started');
var publicRouter = require('./routes/public.js');
app.use('/', publicRouter);
app.listen(port, () => {
console.log(`Listening on port ${port}`)
});
\ No newline at end of file
var express = require('express');
var router = express.Router();
/* GET on root. */
router.get('/', function(req, res, next) {
res.send('This is the public client interface !');
});
module.exports = router;
\ No newline at end of file
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Lektor App</title> <title>Lektor App</title>
<!-- https://electronjs.org/docs/tutorial/security#csp-meta-tag --> <!-- https://electronjs.org/docs/tutorial/security#csp-meta-tag -->
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link rel="stylesheet" href="../style/bootstrap-4.5.2-dist/css/bootstrap.min.css"> <link rel="stylesheet" href="../style/bootstrap-4.5.2-dist/css/bootstrap.min.css">
<script src="../style/jquery/jquery-3.5.1.js"></script>
<script src="../style/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script> <script src="../style/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
......
const electron = require('electron') const electron = require('electron')
const { app, BrowserWindow } = require('electron') const { app, BrowserWindow } = require('electron')
/** Creates the main window and process for the admin interface
*
*/
function createInstanceWindow () { function createInstanceWindow () {
// Create the browser window. // Create the browser window.
const win = new BrowserWindow({ const win = new BrowserWindow({
...@@ -14,19 +19,32 @@ function createInstanceWindow () { ...@@ -14,19 +19,32 @@ function createInstanceWindow () {
// and load the index.html of the app. // and load the index.html of the app.
win.loadFile('instance/index.html') win.loadFile('instance/index.html')
} }
/** Creates the main process for the Express app
* which runs the local server and handles public
* clients
*/
function createExpressClient (){ function createExpressClient (){
const win = new BrowserWindow({ show: false }); const win = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true
}
});
win.loadFile('client/index.html'); win.loadFile('client/index.html');
// Useful for debugging, use with "show: true"
//win.webContents.openDevTools();
} }
app.on('ready', () => { app.on('ready', () => {
console.log('Ready'); console.log('Ready');
createInstanceWindow(); createInstanceWindow();
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
"start": "electron ." "start": "electron ."
}, },
"dependencies": { "dependencies": {
"electron": "^10.1.1" "electron": "^10.1.1",
"express": "^4.17.1"
}, },
"config": { "config": {
"port": "8080", "port": "8080",
......
Impossible d'afficher diff de source : il est trop volumineux. Options pour résoudre ce problème : voir le blob.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter