25 lines
554 B
JavaScript
Executable File
25 lines
554 B
JavaScript
Executable File
require('dotenv').config();
|
|
|
|
const express = require('express');
|
|
const cors = require('cors');
|
|
const itemsRouter = require('./routes/test');
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
app.use(cors());
|
|
app.use(express.json());
|
|
|
|
// 기본 라우트
|
|
app.get('/', (req, res) => {
|
|
res.send('Express API Server Running');
|
|
});
|
|
|
|
// /api/items 라우터 연결
|
|
app.use(`/api/${process.env.APP}`, itemsRouter);
|
|
|
|
console.log(`/api/${process.env.APP}`)
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Server running at http://localhost:${PORT}`);
|
|
}); |