Build the web app:
- Get the code
- Get the code from https://github.com/WildAid/o-fish-web
git clone https://github.com/WildAid/o-fish-web.git
- Get the code from https://github.com/WildAid/o-fish-web
- Go into the o-fish-web directory (if you used git clone) or the o-fish-web-main directory (if you downloaded the code)
- Copy
src/config.js.tmpl
tosrc/config.js
- Edit
src/config.js
and paste:
‘Realm App ID’ into the realmAppId field
‘mongodb-atlas’ into the realmServiceName field
‘wildaid’ into the database field - On commandline, run:
npm install
To build and host the web application locally - recommended for sandbox use and testing
On commandline run:
npm start
Unless otherwise notified, the site will be hosted at http://localhost:3000 - you can skip the rest of this page and proceed to test your changes.
To build the web application for hosting in Realm - recommended for a more permanent instance, or repeated testing
- On commandline, run:
npm run build
When it completes, a “build” directory will be made, with the following files and “static” directory:
asset-manifest.json
index.html
logo192.png
manifest.json
precache-manifest.c369024c97162a63d34202304b2410db.js
robots.txt
service-worker.js
static
- In the Realm UI in your browser, click on “Hosting” on the left-hand side under “MANAGE”
- You should see this page:
- Upload everything inside the build folder by dragging and dropping the files and static directory. The green UPLOAD FILES button does not support uploading a directory like the “static” directory. It is OK to overwrite existing files. When complete, it should look like this:
- Run Actions/Flush CDN Cache, click “Flush Cache” when prompted.
- Make note of the URL on the Hosting page, this is your website! Paste it to the “URL” field in the template
If you have a blue bar that says:
“Your site is in the process of being created, which may take up to 15 minutes.”
then wait until that is gone before proceeding to test your changes.