Skip to content

Website for The United Nations Global Goals for Sustainable Development

Notifications You must be signed in to change notification settings

codeandconspire/globalgoals.org

Repository files navigation

The Global Goals

Website GitHub tag style

Screenshot

Website for The United Nations Global Goals for Sustainable Development www.globalgoals.org

Setup

The application requires Node.js version 7 or later. Start with installing all dependencies by running the following command:

$ npm install

Environment variables

The application (both server and front end) depend on a set of environment variables. Define them in a .env file in the project root. The following command will generate a template for you which you to populate with secret keys and whatnot:

$ npm run setup

Start the server

During development use the restart script which loads the variables in the .env file, before starting the server. The server watches for file changes and restarts when needed.

$ npm restart

Technologies

The stack consists of a Node server running Koa and a front end built with Choo. Content is being fetched from the headless CMS Prismic.io.

Routing to and rendering views are all handled by Choo, the server only fetches content and caches the response.

Koa

Koa is a small framework for node which uses the new async/await syntax of ES2017. Just like most other popular web frameworks, Koa relies on middleware that intercepts and handles requests before (optionally) falling through to the next middleware. With Promises and the new async/await syntax this makes for building very lean and expressive applications.

Choo

Choo is a front-end framework for authoring websites and apps using standard JavaScript syntax and APIs. Templates are defined in JavaScript files as template literals and transformed to actual DOM nodes. The generated tree is then compared with and morphed into the real DOM tree updating where needed, much like React, just without the virtual DOM-part.

Note: Choo is currently exploring ways to incorporate components at the framework level. A preview of the proposed solution is implemented in this application.

SUIT CSS

The CSS is written and organized following the SUIT CSS principles. The source is then processed with a few postcss plugins.

Build and deploy

When building the application, take care to update the version field in package.json. The version number is used for breaking cache and ensuring that clients are receiving up to date assets. Npm has a version command that does just this, commits it and generates a git tag.

$ npm version 2.1.0

To build and minify the client application and styles run the build command. The build script will try and load the local .env file so make sure to define (overwriting) the appropriate variables before executing the script.

$ NODE_ENV=production npm run build

The application is built for running on Now but is in no way required to. Any server with node installed should be able to build and host the application.

License

Creative Commons Attribution 3.0 Unported (CC-BY)

About

Website for The United Nations Global Goals for Sustainable Development

Resources

Stars

Watchers

Forks

Packages

No packages published