Skip to content

Instantly share code, notes, and snippets.

@robinedman
robinedman / apptemplate.rb
Last active December 26, 2015 12:39
Way of exposing Cuba models to a client over a REST API.
#encoding: utf-8
require 'cuba'
require 'mongoid'
require_relative 'mongoidimportexport'
require_relative 'modelexample'
def send_json(document)
res['Content-Type'] = 'application/json; charset=utf-8'
res.write ActiveSupport::JSON.encode(document)

In the "reduce page weight" story we changed so that we only load moment locales for countries that we've deployed the OLC to. We accomplished this with some Webpack trickery and reading the names of the locales in the translations/ folder.

With SOLAS-5735 we've moved the translations to the API, so this folder no longer exists. We insead get the list of locales from a new translations API endpoint which we created.

So far so good. The issue is that we've hardcoded the translations API URL. This will have to be different depending on if we build for test or for deploying to production.

We haven't deployed the Translations REST API to live yet so let's fake the URL for now.

@robinedman
robinedman / GettingStarted.md
Last active July 9, 2018 15:05
Getting started: Node.js and related technologies

Getting started with Node.js development

Installing

Install nvm for managing versions. This allows you to install and switch between different Node versions.

Then install the latest version of Node with:

nvm install stable