diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 00000000..21e9ff3d --- /dev/null +++ b/app.js @@ -0,0 +1,25 @@ +/* + +GEREKLİ PAKETLER YÜKLENİYOR... + +*/ +var http = require('http'); +var express = require('express'); + +var app = express(); + +app.set('port', process.env.PORT || 3005); // 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.'); +}); diff --git a/app/public/styles/styles.css b/app/public/styles/styles.css new file mode 100644 index 00000000..544b62a4 --- /dev/null +++ b/app/public/styles/styles.css @@ -0,0 +1,5 @@ +/* + +STİL KODLARINI BURAYA YAZABİLİRSİNİZ. + +*/ \ No newline at end of file diff --git a/app/routes.js b/app/routes.js new file mode 100644 index 00000000..03b93dd6 --- /dev/null +++ b/app/routes.js @@ -0,0 +1,7 @@ +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İ + }); + +} \ No newline at end of file diff --git a/app/server/views/index.ejs b/app/server/views/index.ejs new file mode 100644 index 00000000..106d4273 --- /dev/null +++ b/app/server/views/index.ejs @@ -0,0 +1,8 @@ + +
+ + + + Örnek Node.js Projesi + + \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 00000000..d479a2f9 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "sample-node-project", + "version": "1.0.0", + "description": "Sample Node.js Project", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Adem Cemil YALCIN", + "license": "ISC" +} diff --git a/readme.md b/readme.md new file mode 100644 index 00000000..5290862b --- /dev/null +++ b/readme.md @@ -0,0 +1,16 @@ +# Sample Node.js Project + +A Node.js project written using Express. EJS was used as the view engine. + +# Installation + +You need to write the following commands on the terminal screen so that you can run the project locally. + +
+git clone git@github.com:acemilyalcin/sample-node-project
+cd sample-node-project
+npm install
+npm start
+
+
+The application is running on [Title](localhost:3000)
\ No newline at end of file