Initial commit
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -137,3 +137,9 @@ dist
|
||||
# Vite logs files
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
/.vs/DELIVER_MAN.slnx
|
||||
/.vscode
|
||||
/obj/Debug
|
||||
*.slnx
|
||||
*.esproj
|
||||
/CHANGELOG.md
|
||||
|
||||
1178
package-lock.json
generated
Normal file
1178
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
package.json
Normal file
20
package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "deliver_man",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node server.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"type": "commonjs",
|
||||
"dependencies": {
|
||||
"express": "^5.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^3.1.11"
|
||||
}
|
||||
}
|
||||
37
server.js
Normal file
37
server.js
Normal file
@@ -0,0 +1,37 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.json({ message: 'Server is running!', status: 'OK' });
|
||||
});
|
||||
|
||||
app.get('/health', (req, res) => {
|
||||
res.status(200).json({ status: 'healthy', timestamp: new Date().toISOString() });
|
||||
});
|
||||
|
||||
// Example POST route
|
||||
app.post('/api/data', (req, res) => {
|
||||
const data = req.body;
|
||||
res.json({
|
||||
message: 'Data received',
|
||||
data: data,
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
});
|
||||
|
||||
app.use((req, res) => {
|
||||
res.status(404).json({ error: 'Route not found' });
|
||||
});
|
||||
|
||||
app.use((err, req, res, next) => {
|
||||
console.error(err.stack);
|
||||
res.status(500).json({ error: 'Something went wrong!' });
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`✅ Server running on port ${PORT}`);
|
||||
console.log(`📡 Local: http://localhost:${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user