Following the instructions on the MEAN.js website, I create a new site and attempt to create a new CRUD using yeoman generator. my command is as follows
$ yo meanjs:crud-module meal
Everything seems to be created correctly in the modules folder, and when I go tho the site, and attempt to create a new "meal" everything seems to work fine until I hit submit. The browser throws the following error
http://localhost:3000/meals/api/meals 404 (Not Found)
Am I missing a step in the setup? is there something additional I need to do to get CRUD to work.
There is something wrong with your routing, check your client/config/routes and server/routes file. The URL should be:
http://localhost:3000/api/meals
without the first meals after 3000. That's why it is a 404.
Hope this helps, if you cant find the problem add some code.
Just put a forward slash(/) in front of api in resource service.
/api/meals instead of api/meals
Related
Here's the sitch:
I downloaded and installed Wampserver64 and Wordpress 5.2.3
I finally made it to my site, but I can't preview or publish pages with the new Gutenberg or block editor because something is broken! When I edit with the Classic Editor, it's all good.
****Here's not the notice I get from the Site Health Plugin****
The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.
The REST API call gave the following unexpected result: (404)
Not Found
The requested URL /wordpress/wp-json/wp/v2/types/post was not found on this server.
Apache/2.4.39 (Win64) PHP/7.3.5 Server at sitefolder Port 80
I have scoured the internet on how to fix this but so far nada. Help much appreciated!
You have to add index.php after your folder name in the URL in order to make WordPress API work on the localhost.
For example: localhost/trial-wordpress/index.php/wp-json/wp/v2/posts
It worked for me.
If you're still working on it try the suggestions from this post: Wordpress REST API (wp-api) 404 Error Even if it's quite old there are some ideas you could try, like switching your permalink structure to sth. other than plain, check mod_rewrite under apache and so on. Classic Editor is not using the REST API, therefore no error.
For example, entering http://mywordpresswebsite.example.com/?json=1 into the browser loads the main site html, the same as omitting the json querystring variable: http://mywordpresswebsite.example.com/
The JSON API is activated. I have tried reactivating and deactivating, checking .htaccess file settings, and deactivating all other plugins. None of those have made much difference so far.
TIA
I had the same problem with my localhost test page and was wondering, why my route worked last week and was not accessible this week.
Short explanation
After some tests and a lot of frustration, I was able to use the REST API Route again by following the wordpress documentation about routes-vs-endpoints with “Pretty Permalinks” and “Ugly” Permalinks
Longer explanation
I guess in my case it was based on the reinstall of my MySQL Database. By installing the new database, my previous setup has been reset to the wordpress standard installation with permalinks as "plain", which is an "ugly" permalink. That's the reason, why the answer of Mattygabe work for me after the reinstall of the database.
But with this solution, I had a problem with my filter value and therefore I found the solution with "pretty premalinks" and changed my permalinks to "Month and name", as shown in the picture. After this change, I could access my REST API via the desired route.
There could be also some difficulties with REST APIs related to the following examples:
using "wp" within the REST route
if you work on plugins, which should be shared, keep on mind that some plugins may restrict REST Access, e.g. iThemes Security
I'm likely doing it wrong, but when I form my requests for a Wordpress installation at http://www.example.com/ like this:
http://www.example.com/index.php?rest_route=/my/rest/route/here
I end up getting proper responses back.
I had a heck of a time figuring this out and ended up grokking a URL formatted like that in the HTML returned to me. I was expecting to make requests as http://www.example.com/wp_json/wp/v2/my/rest/route/here , but I only got HTML responses.
(FWIW, I am reposting this on all similar questions on the StackExchange network. Admins/mods - if this is against the rules or seen as rep spamming, feel free to take it down. Was hoping to help anyone else hitting the same issue I am, and to also learn what it is I've done wrong and why.)
Ok, so the new endpoint for Wordpress 4.7 is mywordpresswebsite.example.com/index.php/wp-json. It's part of Wordpress Core as of 4.7 and not a plugin anymore, there's nothing to be activated. Thank you, Mark Kaplun.
I also experienced this issue. I did install the WP API plugin and then realized I didn't need it so I deactivated it and deleted it. Afterwards I tried a GET request to https://example.com/wp-json/wp/v2/posts and received the HTML of my wordpress site.
To fix this I ended up deactivating all plugins and then I started receiving the JSON response from https://example.com/wp-json/wp/v2/posts so I stepped through each plugin reactivating and in the end all my plugins are active and the endpoint is responding with JSON.
I changed Permalinks (Settings => Permalinks)
I had an issue returning html page instead of JSON response on Wordpress 5.3 and I got resolved when I changed the Permalink as Post name from plain
I will refer to the account as user in this post.
So I put the tcpdf directory in /home/user/laravel/
I then tried to do this in a page:
{{ HTML::link('/tcpdf/examples/example_001.php') }}
and I get the 404 requested page that I setup
any ideas why this is happening or why its not working?
Do I need to do a route maybe?
Any information on this would be great.
If you are really trying to work with TCPDF within your Laravel app, you will most likely want to include it as you would other packages using composer. Please see this answer on how to add TCPDF to composer.json in order to have composer automatically download it into your vendor area: Download tcpdf manually without using composer in Laravel 4 (Ignore the post title - it does talk about including TCPDF with composer.)
What you are achieving with the code sample above is to simply render a link to a certain URI off your URL base. Whether or not that will work will depend on how your local web server is configured and potentially how Laravel and Laravel routing is configured.
Having said all that, I think you are headed down the wrong path with that solution. Ultimately, I believe that what you will want to do is drag TCPDF in using composer, then create a PDF file with code like:
$pdf = new TCPDF();
$pdf->AddPage();
$pdf-> ... other stuff according to the TCPDF API...
$pdf->Output( 'test.pdf', 'I' );
The TCPDF API can be found here: http://www.tcpdf.org/doc/code/classTCPDF.html
You could put some code like that into a controller method to play around and get things working, but later you would probably want to move it elsewhere.
i am trying to use cshtml with Durandal
i followed instructions on
http://bartwullems.blogspot.com/2014/03/durandaljs-enable-razor-views.html
main.js is called properly but when it goes looking for the view i get the error.
View Not Found. Searched for "views/shell" via path "text!views/shell.cshtml".
and in the console window i can see a 404 error
http:// local /App/views/shell.cshtml 404 (Not Found)
route is configured and i copied the web.config from View to App/views and the DurandalViewController is also in place.
my main.js looks like one in the example
just the last line is
app.setRoot('viewmodels/shell');
__________________________________
Structure has
App/viewmodels/shell.js
App/views/shell.cshtml
App/views/web.config
Your issue will be the routing in Asp.net.
Most likely the routing engine will be looking for shell.cshtml in http://localhost/views/shared/shell.cshtml or http://localhost/views/yourControllerName/shell.cshtml by default. You will need to add a route to tell the server side where to find the view.
Hi,
for info I had a similar issue.
Everything was working locally but when I deployed my solution to Azure Web sites I got an error:
Not Found. Searched for "views/shell" via path "text!views/shell.cshtml".
In my case it was http error 500.
Solution was to rename a file from "shell" to something else. I renamed it to base.cshtml (and base.js). It looks that somehow shell.cshtml could not be processed on Azure.
I am developing a website in PHP and I am using mod-rewrite rules. I want to use the Netbeans Run Configuration (under project properties) to set code entry points that looks like http://project/news or http://project/user/12
It seems Netbeans have a problem with this and needs an entry point to a physical file like http://project/user.php?id=12
Has anyone found a good way to work around this?
I see your question is a bit old, but since it has no answer, I will give you one.
What I did to solve the problem, was to give netbeans what it wants in terms of a valid physical file, but provide my controller (index.php in this case) with the 'data' to act correctly. I pass this data using a query parameter. Using your example of project being the web site domain and user/12 as the URL, use the following in the NetBeans Run Configuration and arguments boxes. netbeans does not need the ? as it inserts that automatically, see the complete url below the input boxes
Project URL: http://project
Index File: index.php *(put your controller name here)*
Arguments: url=user/12
http://project/index.php?url=user/12
Then in your controller (index.php in this example), test for the url query param and if it exists parse it instead of the actual Server Request, as you would do normally.
I also do not want the above URL to be publically accessible. So, by using an IS_DEVELOPER define, which is true only for configured developer IP addresses, I can control who has access that special url.
If you are trying to debug specific pages, alternatively, you can set the NetBeans run configuration to:
http://project/
and debug your project, but you must run through your home page once and since the debugger is now active, just navigate to http://project/user/12 in your browser and NetBeans will debug at that entry point. I found passing through my home page every time a pain, so I use the technique above.
Hopefully that provides enough insight to work with your project. It has worked good for me and if you need more detail, just ask.
EDIT: Also, one can make the Run Configuration Project URL the complete url http://project/user/12 and leave the Index File and Arguments blank and that works too without any special code in controller. (tested in NetBeans 7.1). I think I will start using this method.