Numex yayın: server.js
This commit is contained in:
parent
8a600d6508
commit
6c594bd649
23
server.js
Normal file
23
server.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const express = require('express');
|
||||
const path = require('path');
|
||||
const apiRoutes = require('./routes/api');
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// Middleware
|
||||
app.use(express.json());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
// API rotaları
|
||||
app.use('/api', apiRoutes);
|
||||
|
||||
// Ana sayfa
|
||||
app.get('/', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
||||
});
|
||||
|
||||
// Sunucuyu başlat
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Sunucu http://localhost:${PORT} adresinde çalışıyor`);
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user