BoxLang 🚀 A New JVM Dynamic Language Learn More...

Nap Time

v1.0.2 Modules

Nap Time

Teddy Bear Taking a Nap

The laziest app you've ever used. Guaranteed, or your money back.

This simple app will sleep for a specified amount of time and then return a generic response. Nap Time is a useful tool for when you need to simulate slow third-party server responses or handle timeouts in your API wrappers.

Usage

  • Configure server.json with the port you want to listen on.
  • Start the server using Commandbox: server start
  • Make a request to the server and append the number of seconds you want to sleep for in the path like this http://127.0.0.1:{port}/{sleep}/
  • Example: http://127.0.0.1:6969/60/

The server will sleep for the number of seconds specified in the sleep parameter and then return a generic JSON response object. The default sleep time is set to 30 seconds if no sleep parameter is specified in the path.

Sample Response

{
    error: false,
    data: "",
    messages: [
        "What a nice 30 second nap"
    ]
}

About the Author

Designed and developed by Angry Sam Productions, Inc. Visit us at angrysam.com.

License

This software is licensed under the MIT License. See the LICENSE file for details.

Chuck Norris Fact

"Chuck Norris can write infinite recursion functions... and have them return."

Required Attribution

Photo of bear sleeping by Vecteezy

1.0.0

First release

$ box install nap-time

No collaborators yet.
     
5.00 / 1
  • {{ getFullDate("2022-09-23T00:16:58Z") }}
  • {{ getFullDate("2023-01-16T17:27:55Z") }}
  • 773
  • 14