Skip to content

Commit eb7ffbe

Browse files
committed
improving basic demo
1 parent fc771be commit eb7ffbe

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

demos/basic.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ gateway({
99

1010
routes: [{
1111
prefix: '/public',
12-
target: 'http://public.myapp:300',
12+
target: 'http://localhost:3000',
1313
docs: {
1414
name: 'Public Service',
1515
endpoint: 'swagger.json',
1616
type: 'swagger'
1717
}
1818
}, {
1919
prefix: '/admin',
20-
target: 'http://admin.myapp:3000',
20+
target: 'http://localhost:3001',
2121
middlewares: [
2222
require('express-jwt')({
2323
secret: 'shhhhhhared-secret'
@@ -27,3 +27,13 @@ gateway({
2727
}).start(PORT).then(server => {
2828
console.log(`API Gateway listening on ${PORT} port!`)
2929
})
30+
31+
const service1 = require('restana')({})
32+
service1
33+
.get('/hi', (req, res) => res.send('Hello World!'))
34+
.start(3000).then(() => console.log('Public service listening on 3000 port!'))
35+
36+
const service2 = require('restana')({})
37+
service2
38+
.get('/users', (req, res) => res.send([]))
39+
.start(3001).then(() => console.log('Admin service listening on 3001 port!'))

0 commit comments

Comments
 (0)