Summary
Summary of Lecture on RESTful Routes with Postman
In this lecture, the instructor discusses the RESTful routes provided by the Sales framework using the Blueprint API, specifically focusing on using Postman as a REST client for API testing.
Key Points Covered
-
Using Postman:
The instructor demonstrates how to use Postman for testing RESTful routes, reminding users that they can skip account creation if they prefer not to sign up. -
Setting Up Server:
The application runs onhttp://localhost:1337
. Before testing, it's essential to ensure that the server is running. The commandnpm start
is used to start the server. -
Migration Strategy in Models:
The lecture highlights the importance of defining a migration strategy in theconfig/models.js
file. Three strategies are discussed:- Save: Never auto-migrate the database. This is recommended for production to avoid data loss.
- Alter: Auto-migrate changes to the schema while preserving existing data. This is suitable for development.
- Drop: Drops all data and rebuilds everything from scratch. This should be used with caution.
-
Setting Migration Strategy:
The instructor emphasizes defining the migration strategy directly in themodels.js
file to avoid being prompted each time the server restarts. They recommend using "Alter" for development purposes, while "Save" should be the go-to for production. -
Conclusion:
After configuring the migration strategy and starting the server again, the instructor confirms everything is set up, indicating readiness to interact with the API.
This session prepares the audience for further interaction with the API by ensuring their environment is correctly configured.