Skip to content

Commit

Permalink
Ajout d'un serveur HTTP
Browse files Browse the repository at this point in the history
Deux serveurs HTTP et HTTPS sont démarrés avec node. Cela permet d'afficher l'emploi du temps
lorsque l'on se connecte au serveur http dans firefox (la version https ne fonctionne pas encore
donc pas encore d'affichage dans safari
  • Loading branch information
DridriLaBastos committed Feb 20, 2022
1 parent 22831c3 commit b01c814
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ const compression = require( 'compression' );
const express = require( 'express' );
const app = express();
const port = 3000;
const httpPort = 800;
const httpsPort = 4430;
const http = require('http');
const https = require('https');

// EJS
app.set( 'views', './views' );
Expand Down Expand Up @@ -87,4 +91,12 @@ app.use( ( req, res, next ) => {

app.listen( port, () => {
console.log( `Server listening at http://localhost:${port}` );
} );
} );

http.createServer(app).listen(httpPort, () => {
console.log( `HTTP server listening at http://localhost:${httpPort}` );
});

https.createServer(app).listen(httpsPort, () => {
console.log( `HTTPS server listening at http://localhost:${httpsPort}` );
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Info Evry Website",
"main": "index.js",
"scripts": {
"start": "nodemon --ext \"js,ejs,css\" ."
"start": "node .",
"dev": "nodemon --ext \"js,ejs,css\" ."
},
"repository": {
"type": "git",
Expand Down

0 comments on commit b01c814

Please sign in to comment.