sandisunandar99 / api-gateway

test cara kerja api-gatway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test api-gateway

test cara kerja api-gatway dengan auth global

stage 1 : install node.js
stage 2 : install express-gateway
$ npm install -g express-gateway
$ npm update
stage 3 : running api-gateway
$ npm start

Alt text

untuk konfiguras dari api-gateway terdapat di folder /config/gateway.config.yml
stage 4 : mencoba menjalankan url dari api-gateway tanpa authentikasi
stage 5 : mencoba menjalankan url dari api-gateway dengan authentikasi
pertama membuat user untuk dismpan di redis
$ eg users create

Alt text

buat credential untuk user tono untuk mengakses service B atau ::/api/users
$ eg credentials create -c tono -t jwt
keterangan : -c = consumer -t = type (type of credentials)

Alt text

setelah itu copy keySecret untuk dijadikan public key untuk mengakses servis B dan edit di configurasi gateway.config.yml seperti dibawah ini :

Alt text setelah di coba akses ke servis B harus nya keluar pesan Unauthorized Alt text

About

test cara kerja api-gatway


Languages

Language:JavaScript 100.0%