-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.js
35 lines (26 loc) · 1022 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require('marko/node-require').install();
var Koa = require('koa');
var locale = require('koa-locale');
var i18n = require('koa-i18n');
var app = new Koa();
locale(app);
app.use(i18n(app, {
directory: './locales',
locales: ['en', 'es'],
modes: [
'query', // optional detect querystring - `/?locale=en-US`
'subdomain', // optional detect subdomain - `zh-CN.koajs.com`
'cookie', // optional detect cookie - `Accept-Language: zh-CN,zh;q=0.5`
'header', // optional detect header - `Cookie: locale=zh-TW`
'url', // optional detect url - `/en`
'tld' // optional detect tld(the last domain) - `koajs.cn`
]
}));
app.use(require('./src/pages/home'));
var port = 8080;
app.listen(8080, function() {
console.log('Server started! Try it out:\nhttp://localhost:' + port + '/');
if (process.send) {
process.send('online');
}
});