Giter Club home page Giter Club logo

selfies-from-the-trail-demo's Introduction

Selfies from the Trail Demo app

Deploy

Local Development

In order to speed up local development, env vars can be written to a .env file instead of being requested each time the server process starts.

A helper file is included to write the necessary values to the .env file:

./bin/write-env selfies-from-the-trail-staging

Then you should be able to run the server locally:

# This will start the server and webpack for the client
# which will rebuild the client on every change
npm run dev
# If you have nodemon installed and want to
# restart the server on every change as well
npm run nodemon

Production

When starting the app in production mode, the file src/dotenv.js will run one synchronous request to get all the config vars from process.env.SERVER_APP_NAME (using process.env.HEROKU_TOKEN as the token) and write them all to process.env.

Deploying

In order to speed up deploys, the client files are built locally by running npm run build and then committed to the repo. Subsequent deploys will use these committed files. This also speeds up the deploy process by allowing only the server dependencies to be specified in dependencies in package.json.

npm run build
git add dist
git commit -m "Build dist"
git push

Share Domain

The resulting images and html file (used for the Twitter Card) are uploaded and served via S3 and are publically readable.

An environment variable of SHARE_DOMAIN can be set to any domain name including protocol (eg https://share.domain.net) which will be used as the public source for all user readable images and files.

If using a custom SHARE_DOMAIN, that domain will have to be setup to serve files from S3 with the following structure:

http://${BUCKET_NAME}.s3.amazonaws.com/public/${FILE_NAME} --> ${SHARE_DOMAIN}/${FILE_NAME}

Client Config

The client config values are located as part of the server config values in config/ to make it easier to edit and share values across the client/server. To ensure that no sensitive values are written to the client, the client config values are whitelisted inside webpack.config.js.

selfies-from-the-trail-demo's People

Contributors

crcastle avatar lukekarrys avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.