Trying to use Postman to test and see if my post method of an API I'm building works. I keep getting a 405 error, suggesting to me that the functionality of posting isn't even available. But it's a pretty straightforward class, so I can't see what's wrong.
from flask.views import MethodView
from flask import jsonify, request, abort
class BookAPI(MethodView):
    books = [
        {"id":1, "title":"Moby Dick"},
        {"id":2, "title":"Grapes of Wrath"},
        {"id":3, "title":"Pride and Prejudice"}
    ]
    def get(self):
        return jsonify({"books": self.books})
    def post(self):
        if not request.json or not 'title' in request.json:
            abort(400)
        book = {
        "id": len(self.books) + 1,
        "title": request.json['title']
        }
        self.books.append(book)
        return jsonify({'book':book}), 201
The get method is working fine. I can see it on my localhost. But when I try to post to my localhost with postman - 405 error
This is all I'm posting to http://localhost/books/
{
   "title": "Frankenstein"
}
 
    
