How do I link php slim with Ionic Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How can I prevent SQL injection in PHP?PHP: Delete an element from an arraystartsWith() and endsWith() functions in PHPHow do I get PHP errors to display?How do you parse and process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How do I check if a string contains a specific word?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?Ionic 3 Http API Error

An isoperimetric-type inequality inside a cube

Can gravitational waves pass through a black hole?

What did Turing mean when saying that "machines cannot give rise to surprises" is due to a fallacy?

Does the universe have a fixed centre of mass?

Keep at all times, the minus sign above aligned with minus sign below

Problem with display of presentation

Should man-made satellites feature an intelligent inverted "cow catcher"?

Do i imagine the linear (straight line) homotopy in a correct way?

calculator's angle answer for trig ratios that can work in more than 1 quadrant on the unit circle

How to resize main filesystem

How to make an animal which can only breed for a certain number of generations?

NIntegrate on a solution of a matrix ODE

Getting representations of the Lie group out of representations of its Lie algebra

IC on Digikey is 5x more expensive than board containing same IC on Alibaba: How?

How many time has Arya actually used Needle?

Is there a verb for listening stealthily?

Understanding piped commands in GNU/Linux

How do you cope with tons of web fonts when copying and pasting from web pages?

My mentor says to set image to Fine instead of RAW — how is this different from JPG?

Plotting a Maclaurin series

Did pre-Columbian Americans know the spherical shape of the Earth?

Flight departed from the gate 5 min before scheduled departure time. Refund options

Did any compiler fully use 80-bit floating point?

The Nth Gryphon Number



How do I link php slim with Ionic



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How can I prevent SQL injection in PHP?PHP: Delete an element from an arraystartsWith() and endsWith() functions in PHPHow do I get PHP errors to display?How do you parse and process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How do I check if a string contains a specific word?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?Ionic 3 Http API Error



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















this is the code in ionic to link to my slim api:



 postData(credentials, type)

return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);



credentials is my data and type is"signup"



and this is the slim php code tp match the route



$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);


when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory



This is the error showing on the command prompt where i started the the php server
1
how to fix this?










share|improve this question
























  • Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

    – domdambrogia
    Mar 9 at 1:08











  • Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

    – Patrick Sharma
    Mar 9 at 1:54











  • Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

    – domdambrogia
    Mar 9 at 2:08











  • I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

    – Patrick Sharma
    Mar 9 at 3:13


















1















this is the code in ionic to link to my slim api:



 postData(credentials, type)

return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);



credentials is my data and type is"signup"



and this is the slim php code tp match the route



$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);


when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory



This is the error showing on the command prompt where i started the the php server
1
how to fix this?










share|improve this question
























  • Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

    – domdambrogia
    Mar 9 at 1:08











  • Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

    – Patrick Sharma
    Mar 9 at 1:54











  • Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

    – domdambrogia
    Mar 9 at 2:08











  • I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

    – Patrick Sharma
    Mar 9 at 3:13














1












1








1








this is the code in ionic to link to my slim api:



 postData(credentials, type)

return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);



credentials is my data and type is"signup"



and this is the slim php code tp match the route



$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);


when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory



This is the error showing on the command prompt where i started the the php server
1
how to fix this?










share|improve this question
















this is the code in ionic to link to my slim api:



 postData(credentials, type)

return new Promise((resolve, reject) =>
let headers = new Headers();
this.http.post("http://slimapp:8080/api/signup", JSON.stringify(credentials), headers: headers).
subscribe(res =>
resolve(res.json());
, (err) =>
reject(err);
);
);



credentials is my data and type is"signup"



and this is the slim php code tp match the route



$app->post('/api/signup', function(Request $request, Response $response)
// my function is here
);


when i connect postman with php slim, everything works well, but when i connect it with ionic, this error comes up:
[404]: /api/signup - No such file or directory



This is the error showing on the command prompt where i started the the php server
1
how to fix this?







php ionic-framework slim






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 2:02







Patrick Sharma

















asked Mar 9 at 1:03









Patrick SharmaPatrick Sharma

62




62












  • Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

    – domdambrogia
    Mar 9 at 1:08











  • Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

    – Patrick Sharma
    Mar 9 at 1:54











  • Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

    – domdambrogia
    Mar 9 at 2:08











  • I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

    – Patrick Sharma
    Mar 9 at 3:13


















  • Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

    – domdambrogia
    Mar 9 at 1:08











  • Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

    – Patrick Sharma
    Mar 9 at 1:54











  • Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

    – domdambrogia
    Mar 9 at 2:08











  • I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

    – Patrick Sharma
    Mar 9 at 3:13

















Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

– domdambrogia
Mar 9 at 1:08





Hi Patrick, welcome to stack overflow. Are you using this on a local environment? Is 8080 available on your server? If you are using a local host, it likely is. If you are running a vm or cloud server you'll likely have to use a reverse proxy on a web server like nginx.

– domdambrogia
Mar 9 at 1:08













Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

– Patrick Sharma
Mar 9 at 1:54





Hi, I am running it on a local host. I started the php server by going into slim directory from command prompt and the wrote: php -S 127.0.0.1:8080

– Patrick Sharma
Mar 9 at 1:54













Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

– domdambrogia
Mar 9 at 2:08





Then you should be using this.http.post("http://localhost:8080/api/signup", correct?

– domdambrogia
Mar 9 at 2:08













I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

– Patrick Sharma
Mar 9 at 3:13






I have mapped 127.0.0.1 to slimapp in hosts. I tested it on POSTMAN, it works fine, but whenever I connect it from ionic, it gives the error: [404]: /slimapp/api/signup - No such file or directory I also disabled the securities in chrome for running the ionic web

– Patrick Sharma
Mar 9 at 3:13













1 Answer
1






active

oldest

votes


















0














After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



You should be able to do one of two things:



You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



php -S localhost:8080 -t public public/index.php


If you run php --help you can see all of the flags available with the php binary.



php --help
...
-S <addr>:<port> Run with built-in web server.
-t <docroot> Specify document root <docroot> for built-in web server.
...





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072987%2fhow-do-i-link-php-slim-with-ionic%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



    You should be able to do one of two things:



    You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



    Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



    php -S localhost:8080 -t public public/index.php


    If you run php --help you can see all of the flags available with the php binary.



    php --help
    ...
    -S <addr>:<port> Run with built-in web server.
    -t <docroot> Specify document root <docroot> for built-in web server.
    ...





    share|improve this answer



























      0














      After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



      You should be able to do one of two things:



      You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



      Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



      php -S localhost:8080 -t public public/index.php


      If you run php --help you can see all of the flags available with the php binary.



      php --help
      ...
      -S <addr>:<port> Run with built-in web server.
      -t <docroot> Specify document root <docroot> for built-in web server.
      ...





      share|improve this answer

























        0












        0








        0







        After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



        You should be able to do one of two things:



        You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



        Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



        php -S localhost:8080 -t public public/index.php


        If you run php --help you can see all of the flags available with the php binary.



        php --help
        ...
        -S <addr>:<port> Run with built-in web server.
        -t <docroot> Specify document root <docroot> for built-in web server.
        ...





        share|improve this answer













        After looking at your error log (usually better to include formatted error messages in your question rather than linking an image) I noticed you're creating the PHP server in the root of the slim framework, but you're not declaring the document root to the public directory like in the documentation.



        You should be able to do one of two things:



        You can navigate to the public directory - .../htdocs/slimapp/public - and start the PHP server there - php -S 127.0.0.1:8080



        Or you can specify the document root of the server (just like in the docs posted) with the -t flag.



        php -S localhost:8080 -t public public/index.php


        If you run php --help you can see all of the flags available with the php binary.



        php --help
        ...
        -S <addr>:<port> Run with built-in web server.
        -t <docroot> Specify document root <docroot> for built-in web server.
        ...






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 9 at 22:46









        domdambrogiadomdambrogia

        8191022




        8191022





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072987%2fhow-do-i-link-php-slim-with-ionic%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко