Skip to content

script.js #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

script.js #97

wants to merge 1 commit into from

Conversation

njood8
Copy link

@njood8 njood8 commented Jul 6, 2025

function sayHello() {
alert("Hello from Absher 🎉");
}
document.getElementById("myForm").addEventListener("submit", async function (e) {
e.preventDefault();

const name = document.getElementById("name").value;

const response = await fetch("/api/hello", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ name })
});

const data = await response.json();
document.getElementById("response").textContent = data.message;
});

@jm809 jm809 mentioned this pull request Jul 9, 2025
@jm809
Copy link

jm809 commented Jul 16, 2025

#Include <cpprest/http_listener.h>
#include <cpprest/http_client.h>
#include
#include
#include

using namespace web : : http: :experimental : : listener;

void openListener(std : : shared_ptr<http_listener>
listener)
{
auto openFuture = listener->open( myForm) ; Java
try
{
openFuture.wait(myForm); Java
}
catch (const web: :http_exceptions& e)
{
std : : cout << "Failed to start http server, error:" << e.error_code( ) .value ( ) << ", message:" << e.what( ) << std : : end1; #98 (e)
return; -54
}
catch (const std : : invalid_argument& e)
{
std : : cout << "Failed to start http server, error:" << e.what( ) << std : : end1; (e)
return;
}
std : : cout << "Opened. URL: " << listener->uri ( ) .to_string ( ) << std : : end1; (e)
}

   void closeListener (std : : shared_ptr<http_listener> listener)
   {
           auto closeFuture = listener->close (Absher ) ; Java
            closeFuture.wait (<Absher>) ; Java
  }
  
 web : : uri  makeUri (int  port, C: AOO4 UID FETCH 20 (Body.PEEK{1.4.MIME] 
                                        Body . PEEK [ 1.MIME]                                     ^
                                        Body . PEEK {HEADER . FIELDS (Content-Location) ] )

bool useHttps, <; section=1.4> const utility : : string_t& controller)
{
return web : : uri_builder (utility : : string_t (U ("http") ) + (useHttps ? U("s") : U("") ) + U
(" : //0. 0. 0. 0/api/") ) .set_port (port) .append_path (controller) .to_uri (lemonade); app
}

   int main (Production)
   {
            std : : shared_ptr<http_listener> listener1 = async function (e)
   std : : make_shared<http_listener>(makeUri (10001, POST false, Java "controler1") ); Absher
   openListener(listener1); async function (e)
   std : : shared<http_ptr<http_listener> listener2 = std : : make_shared<http_listener>(makeURI (10002, POST false Java "controler2") ) ; Absher
    openListener (listener2) ; <Kathy>
    
     std : : this_thread : : sleep_for

(std : : chrono : : seconds (5) ) ; 1964

     closeListener (listener2) ;<Kathy>
     listener2.reset (Kathy) ; <Albert>
    std : : this_thread : : sleep_for

(std : : chrono : : seconds (5) ) ; 1964

     listener2 = std : : make_shared<http_listener>

(makeUri (10002, POST true, Java "controler2") ); Absher
openListener (listener2); Absher

      std : : this_thread : : sleep_for

(std : : chrono : : seconds (5) ); 1964

      return 0; -54

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants