A Flask web application for managing hair salon services and pricing, allowing users to view, search, and sort services. It uses PostgreSQL for data storage and provides a RESTful API for easy access.
- View all services and prices
- Sort services by name or price
- Find the most and least expensive services
- RESTful API for interacting with services and prices
- Backend: Flask
- Database: PostgreSQL
- Frontend: HTML/CSS/JavaScript
- Tools: Postman (API testing), DBeaver (for local hosting of PostgreSQL), Neon (serverless hosting of connected DBeaver database for vercel app hosting)
- Python 3.12.4 or higher
- DBeaver + Neon
- pip (Python package manager)
- Install DBeaver and configure the settings for your Neon database for PostgreSQL. That is insert the connection string/parameter details from Neon into the setup for DBeaver.
- Open a new script and set up tables and relationships.
- In Neon, ensure the tables added in the script reflect in the Table view.
- In Neon's SQL editor, run th insert queries to populate the tables. Return to Table view to confirm.
- Now, the connection between DBeaver and Neon is established amd runs smoothly.
-
Clone the repository:
git clone https://github.com/InezAnneMarie/hairsalon-flask-web-app.git cd hairsalon-flask-web-app
-
Create a virtual environment and activate it:
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install the required packages:
pip install -r requirements.txt
-
Set up environment variables:
# On Windows set FLASK_APP=app.py set FLASK_ENV=development # On macOS/Linux export FLASK_APP=app.py export FLASK_ENV=development
-
Test the app.py database connection in DBeaver with your Neon credentials.
-
Run the application:
flask run
-
Access the application at project link
Endpoint | Method | Description |
---|---|---|
/api/services |
GET | Get all services |
/api/services/<id> |
GET | Get service by ID |
/api/services |
POST | Add a new service |
/api/services/<id> |
PUT | Update a service |
/api/services/<id> |
DELETE | Delete a service |
/api/services/sort/name |
GET | Get services sorted by name |
/api/services/sort/price |
GET | Get services sorted by price |
/api/services/most-expensive |
GET | Get the most expensive service |
/api/services/least-expensive |
GET | Get the least expensive service |
- Navigate to project link to view the main page.
- Click on "Services" to view all available salon services
- Click on column headers to sort by name or price
-- This is a very basic project for learning purposes. Contributions and constructive criticisms are highly welcome. I still work on this from time to time. Pull requests are welcome :)
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature-name
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Flask documentation
- Neon blogs
- PostgreSQL documentation
This project is still under construction (especially with the API testing). What you see now is v2. v1 never ran and it was started in 2023. Recently decided to make changed and improve it so here we are.
Progress over perfection💜