-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
39 lines (29 loc) · 883 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import express from "express";
//Çevre Değişkenleri İçin(.env)
import dotenv from "dotenv";
//Veritabanı Bağlantısı için
import conn from "./db.js";
//Sayfa Yönlendirme İçin
import pageRoute from "./routes/pageRoute.js";
//UserRoute
import UserRoute from "./routes/userRoute.js";
//Çevre Değişkenleri İçin(.env) Çağırma
dotenv.config();
//Veritabanı Bağlantısı için
conn();
const app=express();
const port=process.env.PORT;
const hostname=process.env.HOSTNAME;
//Html De JavaScript Kodu Yazmak İçin Ejs
app.set('view engine','ejs');
//Static Dosyalara Ulaşmak İçin
app.use(express.static('public'));
app.use(express.json());
app.use(express.urlencoded({extended:true}));
//Route Bölümü
//
app.use("/",pageRoute);
app.use("/users",UserRoute);
app.listen(port, () => {
console.log(`Server Şu Portta Çalışıyor: ${port}`);
});