API Workshop Slides
API Workshop Slides
● use a visitor swipe card to go to the toilet if you forget call 021-0269-6216
exit
toilets
level 6
conference room
Let’s team up
● Similar size groups
● Spread the skills between groups
● No groups less than 4 people
● One group per table
Rainbow of skills
please arrange yourselves in order of programming & javascript skills
Vincent Dirks
Overview
● Create a Web API Server running on your own laptop - This is what dev’s do
● Use Postman to test Web API
Vincent Dirks
Install Postman
from: https://www.getpostman.com/downloads/
and follow OS specific instructions
Install Visual Studio Code
from: https://code.visualstudio.com/Download
● in VS Code
○ open terminal window
■ click the setting cog wheel
■ open the command palette
■ search for ‘terminal’
■ select ‘Create new integrated terminal in active window’
○ execute commands
■ cd \workshop
■ npm init
● should be able to accept all defaults
● this creates package.json file inside workshop folder
● you will be able to update above answers in this file at any time
Install npm dependencies
execute commands
npm install express --save
npm install babel-cli --save
npm audit fix (if needed)
npm install babel-preset-es2015 --save
npm audit fix (if needed)
may still have vulnerability ... that's ok
for each file copy the content from the link below and
paste it into your files
● .babelrc
● app.js
● database/db.js
feel free to have a poke around the code and see what
you can learn, and ask questions from your teammates
and presenters
Start Web API Server 🙂
execute command
node_modules/.bin/babel-node app.js
too cool!!
you’ve programmed your first Web API
well done! Hope this feels good!!
Postman
● open postman application
● paste http://localhost:5000/api/v1/person/info into the request
● click send
● click Send
in your teams
❖ add more tests to the GET request
❖ add tests to the POST request
Collection Runner runs all requests in a collection in order
● copy the GET request & drag to after the POST request
● click Runner (top left of Postman window)
● select your collection
● click Run Workshop
Postman Variables
you can create variables in Postman and use them anywhere in your request!
you can even update them in the code