rs-mock-server 0.6.6

A simple, file-based mock API server that maps your directory structure to HTTP routes. Ideal for local development and testing.
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>RS-MOCK-SERVER</title>
        <link rel="stylesheet" href="/styles.css" />
        <script src="/mock-routes.js"></script>
        <script src="/scripts.js"></script>
    </head>
    <body>
        <header>
            <pre id="logo"></pre>
        </header>
        <div class="container">
            <nav id="routes"></nav>
            <div id="content">
                Welcome to RS-MOCK-SERVER<br />
                Select an endpoint to start<br />
                Hope you enjoy.<br /><br />
                You can consult the documentation
                <a
                    href="https://github.com/lvendrame/rs-mock-server"
                    target="_blank"
                    >here</a
                >.<br />
                Try to use
                <a href="https://github.com/lvendrame/jgd-rs" target="_blank"
                    >JGD files</a
                >, an easy way to generate fake data for your mocks.
            </div>
        </div>

        <template id="api-request-sender-template">
            <style>
                :host {
                    --shell-bg: rgb(16, 3, 33);
                    --shell-text: rgb(184, 184, 184);
                    --shell-accent: #00ff9c; /* A vibrant terminal green */
                    --shell-border: rgb(50, 40, 70);
                    --shell-text-dark: rgb(100, 100, 100);

                    display: block;
                    border: 1px solid var(--shell-border);
                    padding: 16px;
                    margin-bottom: 16px;
                    background-color: var(--shell-bg);
                    color: var(--shell-text);
                }

                /* Blinking cursor animation */
                @keyframes blink {
                    50% {
                        opacity: 0;
                    }
                }

                .row {
                    margin-bottom: 12px;
                    display: flex;
                    flex-wrap: wrap;
                    align-items: center;
                    gap: 12px;
                }

                .method {
                    font-weight: bold;
                    padding: 2px 8px;
                    background-color: var(--shell-border);
                    color: var(--shell-accent);
                }

                .route {
                    font-family: "Fira Code", monospace;
                    color: #9e9eff; /* A soft blue for paths */
                }

                input[type="text"],
                textarea {
                    background-color: var(--shell-bg);
                    color: var(--shell-text);
                    border: none;
                    border-bottom: 1px solid var(--shell-border);
                    font-family: inherit;
                    padding: 6px 2px;
                    caret-color: var(
                        --shell-accent
                    ); /* Blinking input cursor color */
                }

                input[type="text"]:focus,
                textarea:focus {
                    outline: none;
                    border-bottom: 1px solid var(--shell-accent);
                }

                textarea {
                    width: 100%;
                    min-height: 120px;
                    resize: vertical;
                    line-height: 1.5;
                }

                input[type="file"]::file-selector-button {
                    padding: 6px 12px;
                    border: 1px solid var(--shell-accent);
                    background-color: transparent;
                    color: var(--shell-accent);
                    cursor: pointer;
                    font-weight: bold;
                    transition: background-color 0.2s, color 0.2s;
                    margin-right: 8px;
                }

                input[type="file"]::file-selector-button:hover {
                    background-color: var(--shell-accent);
                    color: var(--shell-bg);
                }

                button {
                    padding: 6px 12px;
                    border: 1px solid var(--shell-accent);
                    background-color: transparent;
                    color: var(--shell-accent);
                    cursor: pointer;
                    font-weight: bold;
                    transition: background-color 0.2s, color 0.2s;
                }

                button:hover,
                button:focus {
                    background-color: var(--shell-accent);
                    color: var(--shell-bg);
                }

                .results {
                    margin-top: 16px;
                    padding: 12px;
                    background-color: rgba(0, 0, 0, 0.2);
                    border: 1px solid var(--shell-border);
                    white-space: pre-wrap;
                    word-wrap: break-word;
                    font-family: "Fira Code", monospace;
                    min-height: 50px;
                }

                /* Style for images in results */
                .results img {
                    max-width: 100%;
                    height: auto;
                    border: 1px solid var(--shell-border);
                    border-radius: 4px;
                    display: block;
                    margin: 8px 0;
                }

                /* Add a blinking cursor to the results area for flair */
                .results::after {
                    content: "_";
                    opacity: 1;
                    animation: blink 1s infinite;
                }

                /* Hide cursor when showing images */
                .results:has(img)::after {
                    display: none;
                }

                table {
                    width: 100%;
                    border-collapse: collapse;
                }

                th,
                td {
                    border: 1px solid var(--shell-border);
                    text-align: left;
                    padding: 8px;
                }

                th {
                    color: var(--shell-text-dark);
                }
            </style>

            <div id="main-container">
                <div id="first-row" class="row"></div>

                <div id="conditional-content" class="row"></div>

                <div id="results-container">
                    <div id="results" class="results"></div>
                </div>
            </div>
        </template>
    </body>
</html>