Git Product home page Git Product logo

web-request-simulator's Introduction

Web Request Simulator

This is a basic, lightweight web server using Bun as JavaScript/TypeScript runtime.

This app is really useful in some situations, like:

  • When you need to retrieve some token, text or a HTML page fast, without the need to configure a Nginx/Apache web server, or even creating an Express application from zero
  • When you are trying to generate a Let's Encrypt certificate for a domain/subdomain you own, but you can't solve the .well-known/acme-challenge/xxxxxxxx challenge
  • Retrieve any kind of mock response for any URL path

You can point your IP/host to this app, and he'll retrieve what you pass through environment variables. Simple as that.

Execute in Docker (container)

This code has an public image available in Docker Hub, with the runtime size of only ~88mb. Feel free to use this anywhere you like. ๐Ÿ˜Ž

docker pull simstosh/web-request-simulator

docker run --rm --name web-request -e RESPONSE="<b>Hello World</b>" simstosh/web-request-simulator

Building and running the project

To install dependencies:

bun install

To run the project:

RESPONSE="content to retrieve" bun run dev

Environment variables available to use:

# This env var will be the body of the response. What you provide here, it'll return as response
RESPONSE="<b>Hello world!</b>"

# The port used by the app
PORT=3000

# The content-type of your response. If you don't provide anything, the default will be "text/html"
CONTENT_TYPE="text/html"

web-request-simulator's People

Contributors

simstm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.