- Joined
- Sep 10, 2011
- Messages
- 778
- Reaction score
- 138
xHabbo is an administration panel that is ideally going to cover everything one could ever possibly imagine within the retro business. The system is coded with Javascript built on Google's V8 Engine, (Node).
Some Code Snippets
Dynamic Class Loading
Code:
[COLOR=#474B51]import File from 'glob'[/COLOR]
import Async from 'async'
import Express from 'express'
import Messages from '../messages'
export default class System
{
static launch (cb)
{
const http = Express()
http.use(Express.static(`${homeDirectory}/public/assets`))
Async.series([
// Configure It
function (cb)
{
http.set('views', `${homeDirectory}/public/views`)
http.set('view engine', 'ejs')
cb()
},
// Load Middleware
function (cb)
{
File(`${__dirname}/middleware/**/*.js`, ((e, f) => {
if (!e)
{
f.forEach((fi) => {
const c = require(fi).default
new c (http)
})
cb()
}
else
{
cb(e)
}
}))
},
// Load Controllers
function (cb)
{
File(`${__dirname}/controllers/**/*.js`, ((e, f) => {
if (!e)
{
f.forEach(fi => {
const c = require(fi).default
new c (http)
})
cb()
}
else
{
cb(e)
}
}))
}
], ((e, r) => {
if (e) errorMode = true
http.listen(80, (() => {
cb(null, `HTTP server started in ${Date.now()-timeLaunched}ms`)
}))
}))
}
[COLOR=#474B51]}[/COLOR]
Code:
[COLOR=#474B51]import File from 'glob'[/COLOR]
import Async from 'async'
import Express from 'express'
import Messages from '../messages'
export default class System
{
static launch (cb)
{
const http = Express()
http.use(Express.static(`${homeDirectory}/public/assets`))
Async.series([
// Configure It
function (cb)
{
http.set('views', `${homeDirectory}/public/views`)
http.set('view engine', 'ejs')
cb()
},
// Load Middleware
function (cb)
{
File(`${__dirname}/middleware/**/*.js`, ((e, f) => {
if (!e)
{
f.forEach((fi) => {
const c = require(fi).default
new c (http)
})
cb()
}
else
{
cb(e)
}
}))
},
// Load Controllers
function (cb)
{
File(`${__dirname}/controllers/**/*.js`, ((e, f) => {
if (!e)
{
f.forEach(fi => {
const c = require(fi).default
new c (http)
})
cb()
}
else
{
cb(e)
}
}))
}
], ((e, r) => {
if (e) errorMode = true
http.listen(80, (() => {
cb(null, `HTTP server started in ${Date.now()-timeLaunched}ms`)
}))
}))
}
[COLOR=#474B51]}[/COLOR]
The core is being developed initially to cover anything that could possibly be needed for feature development. This project is going to be built within my free time, which isn't very much due to numerous jobs, school and the military - however I will try my hardest to release a base build for this sometime within the next month.
Installation System
Attachments
You must be registered for see attachments list