Last active
May 3, 2021 17:50
-
-
Save mashpie/5188567 to your computer and use it in GitHub Desktop.
basic plain vanilla setup in node with http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require modules | |
var http = require('http'), | |
i18n = require('i18n'), | |
app; | |
// minimal config | |
i18n.configure({ | |
locales: ['en', 'de'], | |
directory: __dirname + '/locales' | |
}); | |
// simple server | |
app = http.createServer(function (req, res) { | |
// init & guess, see hepler below | |
i18n.init(req, res); | |
res.end(res.__('Hello')); | |
}); | |
// startup | |
app.listen(3000, '127.0.0.1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An example of what the
/locales
folder should contain would help!