20 lines
488 B
JavaScript
20 lines
488 B
JavaScript
|
|
const express = require('express');
|
|||
|
|
const path = require('path');
|
|||
|
|
const apiRoutes = require('./routes/api');
|
|||
|
|
|
|||
|
|
const app = express();
|
|||
|
|
const PORT = process.env.PORT || 3000;
|
|||
|
|
|
|||
|
|
app.use(express.json());
|
|||
|
|
app.use(express.static(path.join(__dirname, 'public')));
|
|||
|
|
|
|||
|
|
app.use('/api', apiRoutes);
|
|||
|
|
|
|||
|
|
app.get('/', (req, res) => {
|
|||
|
|
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
app.listen(PORT, () => {
|
|||
|
|
console.log(`Sunucu http://localhost:${PORT} adresinde çalışıyor`);
|
|||
|
|
});
|