input: Write a function to implement a basic CRUD API for a BlogPost model using Python/Flask. The function should set up the Flask app, define the endpoints for creating, getting, editing, and deleting posts, and should also include the necessary SQLAlchemy models and configurations.
  
  assert create_post('{"title": "First Post", "content": "This is the first post."}')=={"id": 1}
  assert get_posts()==[{"id": 1, "title": "First Post", "content": "This is the first post."}]
  assert get_post(1)=={"id": 1, "title": "First Post", "content": "This is the first post."}
  assert edit_post(1, '{"title": "Updated Post", "content": "This post has been updated."}')=={"id": 1, "title": "Updated Post", "content": "This post has been updated."}
  assert delete_post(1)=={"message": "Post deleted"}
  assert get_posts()==[]
output: from flask import Flask, request, jsonify
  from flask_sqlalchemy import SQLAlchemy
  
  app = Flask(__name__)
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///blog.db'
  db = SQLAlchemy(app)
  
  class BlogPost(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      title = db.Column(db.String(100), nullable=False)
      content = db.Column(db.Text, nullable=False)
  
  db.create_all()
  
  @app.route('/posts', methods=['POST'])
  def create_post(data):
      data = json.loads(data)
      new_post = BlogPost(title=data['title'], content=data['content'])
      db.session.add(new_post)
      db.session.commit()
      return jsonify({"id": new_post.id})
  
  @app.route('/posts', methods=['GET'])
  def get_posts():
      posts = BlogPost.query.all()
      return jsonify([{"id": post.id, "title": post.title, "content": post.content} for post in posts])
  
  @app.route('/posts/<int:post_id>', methods=['GET'])
  def get_post(post_id):
      post = BlogPost.query.get_or_404(post_id)
      return jsonify({"id": post.id, "title": post.title, "content": post.content})
  
  @app.route('/posts/<int:post_id>', methods=['PUT'])
  def edit_post(post_id, data):
      post = BlogPost.query.get_or_404(post_id)
      data = json.loads(data)
      post.title = data['title']
      post.content = data['content']
      db.session.commit()
      return jsonify({"id": post.id, "title": post.title, "content": post.content})
  
  @app.route('/posts/<int:post_id>', methods=['DELETE'])
  def delete_post(post_id):
      post = BlogPost.query.get_or_404(post_id)
      db.session.delete(post)
      db.session.commit()
      return jsonify({"message": "Post deleted"})