An Elasticsearch and React App to find and share recipes for people with allergies.
- Clone this repo and
cdinto it. - Make sure Elasticsearch is setup. You will need to
PUT /recipethe contents ofmappings/mapping.json. Do the same withmappings/mapping.jsoninto/subscription. - Set environment variables. (Important to do this before 3, because the following step will build the React app which looks at environment variables)
npm installnpm startorheroku local web
ELASTICSEARCH_HOST- The Elasticsearch connection stringADMIN_USERNAME- The admin usernameADMIN_PASSWORD- MD5 hex of the admin passwordTOKEN_KEY- Key to create token cookie for loginREACT_APP_TINY_KEY- API key for Tiny CloudREACT_APP_GA_TRACKER- Google Analytics tracking codeNODE_ENV- Set to todevelopmentto avoid the HTTPS redirectPORT- Completely optional - sets the port of the Express serverMAILER_EMAIL- The email address to send emails fromMAILER_PASSWORD- The password of the email to send emails fromMAILER_HOST- The SMTP host to send emails fromMAILER_PORT- The port to send emails from
Visit /login.html and login. A cookie will be set appropriately. You will then be allowed to search for unapproved recipes, edit recipes, delete recipes, and approve recipes. To approve a recipe, simply edit and submit it while logged in.
When you run npm install it will build the react app present in /assets. You may want to run the react server, so you get nice features such as auto-refresh. To do this, simply cd to /assets and run npm start while the main server is also running. You will want to set the NODE_ENV environment variable. You may need to change the proxy line in /assets/package.json to point to the correct port of the Express server.
Set the ELASTICSEARCH_HOST,TEST_USERNAME, and TEST_PASSWORD environment variables to the Elasticsearch host string, admin username, and admin password (not MD5'd) respectively.
Then run: node tests/test.js.
The output should not throw any errors or display anything in red. In addition, it should tell you when bad documents are blocked.
- PUT the
mapping.jsonfile contents to/recipe_test - Run:
POST _reindex
{
"source": {
"index": "recipe"
},
"dest": {
"index": "recipe_test"
}
}
- Do a test search to make sure all the documents copied to recipe_test
DELETE /recipe- PUT the
mapping.jsonfile contents to/recipe - Run
POST _reindex
{
"source": {
"index": "recipe_test"
},
"dest": {
"index": "recipe"
}
}
- Make sure all the results are now available on Making Do Recipes and run
DELETE /recipe_test
Logo - logomaker.com (logomakr.com/0crQUx) Special Thanks to all the npm package authors
