archived
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
const express = require("express");
|
||||
const path = require('path')
|
||||
const app = express();
|
||||
app.use(express.json()); // JSON 본문을 파싱하기 위해 필요합니다.
|
||||
|
||||
|
||||
app.use("/public", express.static(path.join(__dirname, 'public')));
|
||||
app.listen(4000, () => {
|
||||
console.log(`Server running at http://127.0.0.1:4000`);
|
||||
});
|
||||
app.get("/", (req, res) => {
|
||||
res.sendFile(__dirname + "/public/index.html")
|
||||
// res.send("hello world")
|
||||
});
|
||||
app.use(express.urlencoded({ extends: true }));
|
||||
|
||||
app.post('/your-endpoint', (req, res) => {
|
||||
console.log('Received data:', req.body); // 받은 데이터를 콘솔에 출력합니다.
|
||||
res.json({ message: 'Data received successfully' }); // 응답을 보냅니다.
|
||||
});
|
||||
Reference in New Issue
Block a user