In this example, I am not able to send request from other system in local network.
// Copyright (c) 2020 Cesanta Software Limited
// All rights reserved
//
// HTTP server example. This server serves both static and dynamic content.
// It implements the following endpoints:
// /api/f1 - respond with JSON string {"result": 123}
// /api/f2/:id - wildcard example, respond with JSON string {"result": "URI"}
// any other URI serves static files from s_web_directory
//
// To enable SSL/TLS (using self-signed certificates in PEM files),
// 1. Change s_listen_on from http:// to https://
// 2. make MBEDTLS_DIR=/path/to/your/mbedtls/installation
// 3. curl -k https://127.0.0.1:8000
#include "mongoose.h"
static const char *s_listen_on = "https://localhost:8000";
static const char *s_web_directory = ".";
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
This file has been truncated. show original
That’s right, because this example listens only on your computer, localhost
.
Change localhost
to 0.0.0.0
and you’ll be able to connect from any computer in your LAN.