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
Branches
Étiquettes
2 requêtes de fusion!3Dev kubat,!1Create basic lib
......@@ -3,15 +3,11 @@
<head>
<meta charset="UTF-8">
<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">
<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>
<body>
<!-- main file running the express app -->
<script src='./main.js' type='text/javascript'></script>
</body>
</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 @@
<meta charset="UTF-8">
<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">
<script src="../style/jquery/jquery-3.5.1.js"></script>
<script src="../style/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
......
const electron = require('electron')
const { app, BrowserWindow } = require('electron')
/** Creates the main window and process for the admin interface
*
*/
function createInstanceWindow () {
// Create the browser window.
const win = new BrowserWindow({
......@@ -14,19 +19,32 @@ function createInstanceWindow () {
// and load the index.html of the app.
win.loadFile('instance/index.html')
}
}
/** Creates the main process for the Express app
* which runs the local server and handles public
* clients
*/
function createExpressClient (){
const win = new BrowserWindow({ show: false });
const win = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true
}
});
win.loadFile('client/index.html');
// Useful for debugging, use with "show: true"
//win.webContents.openDevTools();
}
app.on('ready', () => {
console.log('Ready');
createInstanceWindow();
......
......@@ -14,7 +14,8 @@
"start": "electron ."
},
"dependencies": {
"electron": "^10.1.1"
"electron": "^10.1.1",
"express": "^4.17.1"
},
"config": {
"port": "8080",
......
Ce diff est replié.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter