-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.demo.js
31 lines (23 loc) · 861 Bytes
/
app.demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function hellowStatusHandler() {
console.log('Hello From server handler');
return "hello from browser status handler";
}
import express from 'express';
import customResponsesMiddleware from './app.js'
import { basicConfig } from './config/basic.js';
import { responseConfig } from './config/config.js';
const app = express();
// Use customResponsesMiddleware with multiple configuration files
app.use(customResponsesMiddleware([basicConfig, responseConfig]));
// Example route using existing keys
app.get('/success', (req, res) => {
res.success({ message: 'Config hsserer done' });
});
// Example route using 'custom' configuration
app.get('/custom', (req, res) => {
res.custom({ message: 'Custom response message' });
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});