-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.ts
44 lines (33 loc) · 887 Bytes
/
app.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
let jaiServer = require('./dist/index.js');
const path = require('path');
const app = jaiServer({
});
app.get('/', (req, res, next) => {
res.send('Hello World - Jai Server');
//next(); // calling next middleware
});
app.listen(1111, () => {
console.log('Server started on port 1111');
});
// const router = jaiServer.Router();
// router['get']('/test', (req, res, next) => {
// res.send('Test');
// next();
// });
// app.use(router); // Use router
// app.use( // Middleware
// (req, res, next) => {
// console.log('middleware');
// next();
// },
// (err, req, res, next) => {
// console.log('error middleware');
// next();
// }
// );
// app.get('/error', (req, res) => { // Error route
// throw new Error('Test error');
// });
// app.use((err, req, res, next) => { // Error handler
// res.status(500).json({ error: err.message });
// });