Skip to content
/ FrietDB Public

This web app shows the menu and more info about 'frituren' in the Ghent area.

License

Notifications You must be signed in to change notification settings

tuur29/FrietDB

Repository files navigation

FrietDB

This web app shows the menu and more info about 'frituren' in the Ghent area.

API Keys

You will have to add 3 files, 2 are called /src/environments/environment(.prod).ts with the necessary api keys and should look like this:

export const environment = {
  production: true,
  backendurl: "https://<URL>:<SERVER_PORT>/<API_PATH>",
  imgurapikey: "<PASTE_PRODUCTION_API_KEY>",
  mapskey: '<PASTE_PRODUCION_API_KEY>'
};

You will need a Google Maps Javascript API key and a Imgur API key.

The third file should be called /server/.env and looks like this:


MONGODB_URI=mongodb://localhost/frietdb
JWT_SECRET=-e,aj(ef,X$X>F6'^uDH8;u\uDDz)"9`

Testing

There are tests for the backend server. go to /server/ in your terminal and execute the command npm run testsetup, for subsequent runs you should use npm run test.

Development server

Run npm run all for a full dev server. Navigate to http://localhost:4200/. The frontend will automatically reload if you change any of the source files.

More options

  • npm start : runs only frontend Angular 4 app
  • npm run mongo : runs backend MongoDB server
  • npm run express : runs backend Express.js server
  • npm run server : runs all backend servers

Build & Deploy

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

Github Pages

When building for Github Pages you should build with add: --base-href "https://USERNAME.github.io/REPOSITORY_NAME/". Next, duplicate the index.html file and name it 404.html .

To publish it, remove /dist from .gitignore, make a local commit and push to the gh-pages branch with:

$ git push origin `git subtree split --prefix dist master`:gh-pages --force

Lastly undo the edit in .gitignore and reset your master branch with git reset HEAD~. Don't forget to re-enable your custom domain if you are using one.

More Info

Heroku

Navigate to the root of the project and add your heroku app to the repo by running:

$ heroku git:remote -a frietdb

Next you can install mongodb by running heroku addons:create mongolab. Lastely push the server to your heroku dyno with:

$ git subtree push --prefix server heroku master

You will only need to repeat the previous command when you wish to update the dyno.

Automated deploy

The script deploy.sh should do all the above actions automatically. Just make sure you change the domainname in the script. You should have completed the process manually first before you use the script.

More Info

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.