- 📖 About the Project
- 💻 Getting Started
- 👥 Authors
- 🔭 Future Features
- 🤝 Contributing
- ⭐️ Show your support
- 🙏 Acknowledgements
- ❓ FAQ (OPTIONAL)
- 📝 License
Real-Time Search Box is an app that enables users to search for articles in real-time and provides analytics on their search queries.
Client
Server
Database
- Search for articles and view results as you type
- Automatically save search history
- Access previous searches on the Latest Search page
The user interface for the search box and search results was designed using erb and JavaScript. JavaScript was chosen because it's difficult to listen to user typing with only erb. By utilizing JavaScript events, the search function can respond immediately to user input. When a search query matches an article, the corresponding article is immediately displayed. In cases where the user stops typing for more than 5 seconds, the search query is recorded and sent to the backend for processing.
To get a local copy up and running, follow these steps.
- Ruby version: 3.2.1
- Ruby on Rails version: 7.0.3.1
Clone this repository to your desired folder:
cd my-folder
git clone https://github.com/medaminedev66/real-time-search-box.git
cd real-time-search-box
Install this project with:
bundle install
# create migrations with activerecord
rails db:migrate
# if you would like to use seed data
rails db:seed
To run the project, execute the following command:
# start server
rails s
RoR uses port 3000 by default
To run tests, run the following command:
# run tests with
rspec spec
Heroku has been used to deploy this project. You can use it as well or use other alternatives such as Render, Fly...
Amine Smahi
- GitHub: @medaminedev66
- Twitter: @medaminesmahi
- LinkedIn: Amine Smahi
- Add sessions using Devise to record searches for each user.
- Create a backend algorithm that searches for articles and displays them on another page.
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
I would like to thank ChatGpt, StackOver flow community for the help and support.
-
Why are the rspec tests failing?
- I'm using
capybara
andselenium
gems that help me to write and run tests. Selenium is a popular tool for automating web browser interactions. You will need to have a web browser installed on your local machine. We recommend using Mozilla Firefox, as that is the browser I use in my testing environment. If you already have Firefox and you still have errors, these errors occurs when the Firefox driver is unable to find the Firefox binary location. By default, the driver will look for the Firefox binary in a set of default locations, but if it is not found, you will see this error. To fix these errors, you can specify the location of the Firefox binary using the :firefox_binary option in the Capybara configuration in spec/rails_helper.rb or spec/spec_helper.rb:
- I'm using
This project is MIT licensed.