Skip to content

FabioBeneditto/simple-test-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Test API

Main Goal

Useful in code tests:

  • main uri reveals /api/ uri
  • /api returns random http status code
  • for tests, /api/418 returns 418 http status code
  • if http status code is between 100 and 399 returns image uri
  • if http status code is 5xx randomly drops connection
    • with additional parameter /api/5xx/1 connection was not dropped (useful for tests)

Requirements

  • node and npm
  • .env for local running
    • PORT=3000 or other as you wish
    • API_KEY from Pexels API - to get random image URI
  • for remote hosting I'm using Heroku

How to use locally

  • npm install
  • set .env variables
  • node index.js
  • open http://localhost:3000 (replace 3000 with your .env PORT config)

About

A simple API returns random HTTP codes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published