Setup
Environment Setup
Section titled “Environment Setup”- Clone this repository to your local machine.
git clone https://github.com/vikiru/restasaurus.gitcd restasaurus- Download and install all required dependencies.
npm install- Setup your
.envfile with the required information.
PORT=YOUR-PORT-HEREMONGODB_URI='YOUR-MONGODB-URI-HERE'NODE_ENV='development'Retrieving data from Wikipedia via its API
Section titled “Retrieving data from Wikipedia via its API”Run the retrieveData script to retrieve all dinosaur information.
npm run retrieveDataThis script will retrieve information about dinosaurs from Wikipedia via its API and then process that data to construct a JSON object represented by MongooseData.
Please check the app/logs directory in the event of any errors. Specifically, you can check the errors.log or all.log to view the errors or all levels of logging, respectively.
Additionally, confirm that app/scripts contains the following JSON files:
allDinoNames.json: contains all dinosaur names (should be around 1427 names).filteredNames.json: contains the names of the dinosaurs that passed the filtering process (should be around 1153 names).htmlData.json: contains the raw HTML for each Wikipedia article as a String.imageData.json: contains the image data for each Dinosaur.pageData.json: contains the page data for each Wikipedia article.dinosaurData.json: contains the processed data of all dinosaurs.
Saving the processed data to the MongoDB database
Section titled “Saving the processed data to the MongoDB database”Run the postData script to save all dinosaurs to your MongoDB database, once retrieveData was successful.
npm run postDataPlease check your MongoDB database collections and ensure that the dinosaurs were saved successfully.
There should be 5 collections:
classificationinfos: This collection contains all of the ClassificationInfo documents.counters: This collection is auto-created and allows for auto-indexing of documents.dinosaurimages: This collection contains all of the DinosaurImage documents.dinosaurs: This is the main collection which contains all of the Dinosaur documents.dinosaursources: This collection contains all of the DinosaurSource documents.
After completing these steps, the API should be ready for launch, with all endpoints fully operational.