Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.
Alexander Dadukin edited this page Jun 5, 2016 · 1 revision

A utility that allows you to create location-based applications for the web.

There is some advantages:

  • Easy to use
  • It supports two syntaxes
  • Constantly evolving

Simple example with fluent (try) syntax

'use strict';

const http = require('http');
const queryString = require('query-string');
const DefaultLocale = require('default-locale');
const localeConfig = require('./config/custom')(__dirname);

const RS = 'rs'; // resource field
const LN = 'ln'; // language field

const server = http.createServer((req, res) => {
	const query = queryString.parse(req.url.substr(1));
	DefaultLocale.init(localeConfig);

	const resource = DefaultLocale.tryString(query[RS], query[LN]);
	if (!resource) return res.end('There is no resource');
	res.end(resource);
});

server.listen(3000);
Clone this wiki locally