Skip to content

Instantly share code, notes, and snippets.

@jkyberneees
Last active December 2, 2019 17:46
Show Gist options
  • Save jkyberneees/561d81120e83b404ff8ed77490e79d6d to your computer and use it in GitHub Desktop.
Save jkyberneees/561d81120e83b404ff8ed77490e79d6d to your computer and use it in GitHub Desktop.
const gateway = require('fast-gateway')
const PORT = process.env.PORT || 8080
gateway({
middlewares: [
require('cors')(),
require('helmet')()
],
routes: [{
prefix: '/public',
target: 'http://public.myapp:300'
}, {
prefix: '/admin',
target: 'http://admin.myapp:3000',
middlewares: [
require('express-jwt')({
secret: 'shhhhhhared-secret'
})
]
}]
}).start(PORT).then(server => {
console.log(`API Gateway listening on ${PORT} port!`)
})
@gvalmana
Copy link

Hi Gustavo, could you please indicate which example you are using? Also pasting here your code would help. Thanks

On Sun, Sep 29, 2019, 7:25 PM Gustavo Valmaña Villalonga < @.***> wrote: Hello Rolando, when i try to use the exemple the system showme this answer message | "Route GET:/public not found" -- | -- error | "Not Found" statusCode | 404 it does not matter what route i try to use — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://gist.github.com/561d81120e83b404ff8ed77490e79d6d?email_source=notifications&email_token=AA7IGXCK6IZD43GRD2UHE63QMDQIRA5CNFSM4I3TIZH2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFZSSQ#gistcomment-3040552, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7IGXBGBNAMMVOXPMY46T3QMDQIRANCNFSM4I3TIZHQ .

hello my friend, do you speak spanish? my english is not so good, is more easy to me explain you in spanish

@jkyberneees
Copy link
Author

Hola @gvalmana, si, hablo español. Te decía que si puedes pegar aquí el código donde usas fast-gateway. Me ayudaría a entender donde está el problema en tu lado.

Saludos

@gvalmana
Copy link

Hola @gvalmana, si, hablo español. Te decía que si puedes pegar aquí el código donde usas fast-gateway. Me ayudaría a entender donde está el problema en tu lado.

Saludos

Bien el ejemplo que estoy usando es ese mismo que tienes puesto, lo unico que hice fue cambiar el target de la ruta
{
prefix: '/public',
target: 'http://public.myapp:300'
},
a
{
prefix: '/public',
target: 'http://localhost/micro-app/web/index.php?r=estudiante/'
},
y sea la ruta que ponga en el prefix, me dice que esa ruta no existe, tengo una duda, debo usar express para crear las rutas en mi app?

@mikevb3
Copy link

mikevb3 commented Dec 2, 2019

@gvalmana revisa si tu localhost no requieres algun puerto, o intenta poner localhost:80/micro....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment