| JavaScript API Frameworks | Testing API Endpoints with Supertest |
To run the demo repo code:
- Fork and clone this repo
cd fp_study_notes_api_frameworks- Install dependencies
cd servernpm install
- Start your server
- make sure you are inside the server folder
npm start
- Open your client
cd ../clientopen index.html(or server of your choice eg. node'shttp-serveror python'spython -m http.server)
To run the server tests:
- make sure you are inside the server folder
npm run dev- you can use
npm run coverageto check the test coverage
To run the client tests:
- make sure you are inside the client folder
npm install(you only need to do this before your first client test run)npm test- you can use
npm run coverageto check the test coverage
Working in pairs:
-
Start work on your own API!
- You can choose what your API does
- You can choose what you use to create it eg. http module/express/alternative framework.
- Write some tests using jest and supertest and check your coverage with jest, aiming for minimum 60-80% coverage.
- Consider RESTful routing
- As a stretch goal, try and implement all four parts of CRUD functionality (Create, Read, Update, Delete)
-
Use our Presentation Tips to help prepare a 5 minute presentation of your new API including:
- technologies / libraries used
- challenges and solutions
- a live demonstration of your API's functionality: you could demonstrate using
curl, Postman, a custom client or a combination!
- There will be open Q&A after each presentation