From 03a31412805127e0a0f1be50484bd2fdba4a1236 Mon Sep 17 00:00:00 2001 From: acyalcin Date: Sun, 6 Jul 2025 03:55:16 +0200 Subject: [PATCH] Improved the comments --- app.js | 32 +++++++++++--------------------- app/public/styles/styles.css | 9 ++++----- app/routes.js | 6 ++---- app/server/views/index.ejs | 5 +++-- 4 files changed, 20 insertions(+), 32 deletions(-) diff --git a/app.js b/app.js index 974b2dd9..3d19fdc2 100644 --- a/app.js +++ b/app.js @@ -1,26 +1,16 @@ -/* +// Importing required packages +const http = require('http'); +const express = require('express'); -GEREKLİ PAKETLER YÜKLENİYOR... +const app = express(); -*/ +app.set('port', process.env.PORT || 3000); // Application port is set +app.set('views', __dirname + '/app/server/views'); // Views folder is set +app.set('view engine', 'ejs'); // View engine is set +app.use(express.static(__dirname + '/app/public')); // Public folder containing static files is set -var http = require('http'); -var express = require('express'); +require('./app/routes')(app); // Routes are imported -var app = express(); - -app.set('port', process.env.PORT || 3000); // GİRİŞ PORTU AYARLANDI -app.set('views', __dirname + '/app/server/views'); // VIEW KLASÖRÜ TANITILDI -app.set('view engine', 'ejs'); // VIEW ENGINE AYARLANDI -app.use(express.static(__dirname + '/app/public')); // KULLANICILAR TARAFINDAN ERİŞİLEBİLEN KLASÖR TANIMLANDI - -require('./app/routes')(app); // ROUTE DOSYASI ÇAĞIRILDI - -/* - -HTTP SERVER OLUŞTURULDU - -*/ http.createServer(app).listen(app.get('port'), function(){ - console.log('Sistem ' + app.get('port') + ' Portu Üzerinde Çalışıyor.'); -}); + console.log('The application is running on port ' + app.get('port')); +}); // Http server is created diff --git a/app/public/styles/styles.css b/app/public/styles/styles.css index 544b62a4..cf626c5e 100644 --- a/app/public/styles/styles.css +++ b/app/public/styles/styles.css @@ -1,5 +1,4 @@ -/* - -STİL KODLARINI BURAYA YAZABİLİRSİNİZ. - -*/ \ No newline at end of file +/* Custom styles can be added to this file */ +span { + font-size: 50px; +} \ No newline at end of file diff --git a/app/routes.js b/app/routes.js index 03b93dd6..d001bdc8 100644 --- a/app/routes.js +++ b/app/routes.js @@ -1,7 +1,5 @@ module.exports = function(app) { - - app.get('/',function(req,res){ // İSTEMCİNİN '/' İSTEĞİNE KARŞILIK VEREN KOD BLOĞU - res.render('index'); // INDEX VİEW DOSYASI RENDER EDİLDİ + app.get('/', function(req, res){ + res.render('index'); // index view file is rendered when HTTP GET '/' called }); - } \ No newline at end of file diff --git a/app/server/views/index.ejs b/app/server/views/index.ejs index 106d4273..fe2d4951 100644 --- a/app/server/views/index.ejs +++ b/app/server/views/index.ejs @@ -1,8 +1,9 @@ - + + Sample Node.js Application - Örnek Node.js Projesi + Sample Node.js Application \ No newline at end of file