free-programming-books-search/README.md

61 lines
3.2 KiB
Markdown
Raw Normal View History

# free-programming-books-search
2022-04-21 21:51:12 +00:00
The free-programming-books-search is a companion project of [free-programming-books](https://ebookfoundation.github.io/free-programming-books/). It allows users to search by book title or author and filter by language. The search index is updated once per day, so changes made on [free-programming-books](https://ebookfoundation.github.io/free-programming-books/) may not be immediately reflected.
2022-04-21 22:06:01 +00:00
## Contents
- [Contents](#contents)
- [How It All Works](#how-it-all-works)
2022-04-21 22:11:46 +00:00
- [Installation](#installation)
- [NPM Installation](#npm-installation)
- [Running the Website](#running-the-website)
2022-04-21 22:11:46 +00:00
- [Deployment](#deployment)
- [FAQ](#faq)
2022-04-21 22:06:01 +00:00
## How It All Works
1. THERE IS NO DATABASE INVOLVED. Rather, the books are stored in a markdown on [free-programming-books](https://ebookfoundation.github.io/free-programming-books/) and is parsed daily by [free-programming-books-parser](https://github.com/EbookFoundation/free-programming-books-parser). The books and all info pertaining to them are stored in a JSON file called `fpb.json`.
2. This JSON is downloaded locally and searched locally when the actual search function is used.
2022-04-21 22:06:01 +00:00
## Installation
2022-04-22 00:52:58 +00:00
### NPM Installation
2022-04-30 17:24:51 +00:00
1. Make sure you have [Node.js](https://nodejs.org/en/) installed. If you already do, skip to [Running the Website](#running-the-website).
2022-04-22 00:54:20 +00:00
2. Otherwise, download the LTS installer from [Node.js](https://nodejs.org/en/) website.
3. Follow the instructions of the installer, make sure npm is listed as a package to be installed.
4. Click Install.
5. Verify that Node.Js has been installed by going to command line and typing in `node`. It should show the current version.
2022-04-30 17:32:08 +00:00
6. Close out of Node by either closing and reopening the command line or with <kbd>Ctrl + C</kbd>.
2022-04-22 00:54:20 +00:00
7. Make sure to check out the [NPM website](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for more info.
2022-04-22 00:52:58 +00:00
### Running the Website
1. Make sure you have [Git](https://git-scm.com/downloads) installed.
2022-04-22 00:54:20 +00:00
2. Clone the repo from Github with Git.
2022-04-30 17:32:08 +00:00
3. Navigate to the folder using command line. A easy way is to type "`cd`" and then drag and drop the folder into command line.
2022-04-30 17:24:51 +00:00
4. Type `npm install`.
5. Type `npm install react-scripts`.
2022-04-30 17:26:46 +00:00
6. Type `npm start`. At this point, the command prompt should start up the server, and a tab in your default browser should open up to localhost.
2022-04-21 22:08:29 +00:00
2022-04-21 22:11:46 +00:00
## Deployment
2022-04-22 18:04:36 +00:00
MAKE SURE YOU HAVE COMPLETED THE INSTALLATION STEPS FIRST!
2022-04-30 17:32:08 +00:00
1. First, make sure that you the local folder containing the files has a remote configured called "`origin`".
1. If you aren't sure, navigate to the folder using Git (type "`cd`", then drag and drop folder in to Git command line).
2022-04-30 17:24:51 +00:00
2. Type `git init`.
3. Type `git remote add origin <repo url>`, replacing `<repo url>` with the url of your github repository.
2022-04-22 18:07:25 +00:00
2. Now, run `npm install -g gh-pages`.
2022-04-22 18:05:28 +00:00
3. Run `npm run deploy`.
2022-04-30 17:32:43 +00:00
4. This should deploy your code to "`https://yourusername.github.io/free-programming-books-search/`".
## FAQ
- What database are we using to store the books?
2022-04-30 17:36:53 +00:00
- NONE! The books are stored in a JSON file which is downloaded locally.
- I added a book but it's not showing up on search?
2022-04-30 17:34:19 +00:00
- Give it some time. The parser is run once a day, so it may take up to 24 hours for the search to reflect that.