A browser-based MMORPG in a fantasy world.
uonline expects environment variables DATABASE_URL
and DATABASE_URL_TEST
to be set. If they are not, it will use following default credentials. You'll probably find it convinient to make the dev environment match them.
localhost
;anonymous
with password nopassword
;uonline
and uonline_test
.script/setup
. Please note that it expects database credentials to be set. Also, it will try to create databases if they don't exist.By the way, running script/update
will update the stuff like dependencies and DB revisions. You typically use it after every pull.
Run script/run
.
There are also some alternatives:
foreman start
if you want to simulate Heroku environment../main.coffee
for plain run.make monitor
to automatically restart server on changes.The following environment variables are recognized:
IP
, PORT
— IP and port to listen;DATABASE_URL
, DATABASE_URL_TEST
— database credentials;SQLPROF
=true
— show SQL timings in console;NOCSP
— don't output CSP header;NEW_RELIC_LICENSE_KEY
— you don't need this.This project uses Scripts to Rule Them All for performing routine tasks. All scripts except console
are supported.
Run gulp
to check and test your code. It will lint your code, run tests, show coverage stats and so on. Please run it before every commit.
Useful subtasks:
gulp check
— only lint;gulp build
— build static assets;gulp watch
— same as gulp build
, but works automagically.gulp test
— run unittests without additional checks.Useful options:
gulp test --single health-check.coffee
— run only one testsuite;gulp test --reporter verbose
— use other reporter.'
itself.use strict
in every file.require('./utils.js');
.fs.readFile.sync()
is way better than fs.readFileSync()
.?
when checking for null or undefined: if error? then ...
.->
is preferred, () ->
is acceptable.unless
instead of if not
. Don't use unless ... else
at all.is
instead of ==
when you don't mean calculations.if (!!something)
when checking for null or undefined.exports.closeSession = function(dbConnection, sess, callback) {
if (!sess)
{
callback(undefined, 'Not closing: empty sessid');
}
else
{
dbConnection.query(
'UPDATE `uniusers` SET `sessexpire` = NOW() WHERE `sessid` = ?',
[sess], callback);
}
};
var numbers = [
1,
2,
3,
4,
];