From the course: Building RESTful APIs with Flask

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Registering new users

Registering new users

From the course: Building RESTful APIs with Flask

Start my 1-month free trial

Registering new users

- [Instructor] With Flask-JWT installed, let's build out our user management system starting with a route to handle registering new users. In a real application, you might want to make this fancier by adding an approval workflow but we're scientists and we're all good people, so let's keep it simple. I'll create my new route right below the last one that I finished. So, below planets. Here I'll add app.route and I'll call it register and on this one, I'm going to limit the methods to just POST. Next, I'll make my function definition. And now I'm ready to go to work. For this route, I'm assuming that the calling application is using HTML forms. Obviously this is supported in HTML but most other languages and environments allow you to construct HTML form fields for use with APIs. You might want to support a pure JSON post in your API and I'll show you how to do that a little bit later. Getting back to keeping it simple, let's grab the email address from the submitted form. I'll type in…

Contents