I am wondering what the best practice is for scenerios like serving a signup page to create new users. There are two separate things going on here.. 1) application must forward a user creation html page and 2) user creation forum must be passed to an endpoint for user creation.
Should you combine these two processes as part of your application logic? Or should user creation be handled by a separate API and application would only serve html?
Option #1:
// Application routes serving HTML for GET and updating user state for POST
@app.route('/signup', methods=['GET', 'POST'])
return html--^ ^---- create new user
Option #2:
// Application routes serving HTML for GET:
@app.route('/signup', methods=['GET'])
// Seperate REST API endpoint for user creation:
@app.route('/api/user/', method=['POST'])