* Create a nascent version of the mod detail page * Make the slug mandatory for Mod instead of name, and load the name from the data file * Make the Feedback view universal on all pages * Refactor the use of mod pack to have a single global object at the router level which is shared between pages. Further, make this one object load itself immediately and have it automatically load any activated mod version * Refactor the use of Storage related to mod pack versions into the router as well. * Add trace logging back in for events, but allow individual classes to suppress it (as opposed to actually supressing the events) * Fix a bug in ModVersion.eachItem where it would suggest so-called items which are merely registered slugs without associated items
49 lines
1.4 KiB
CoffeeScript
Executable File
49 lines
1.4 KiB
CoffeeScript
Executable File
#!/usr/bin/env coffee
|
|
#
|
|
# Crafting Guide - server
|
|
#
|
|
# Copyright (c) 2014-2015 by Redwood Labs
|
|
# All rights reserved.
|
|
#
|
|
|
|
express = require 'express'
|
|
path = require 'path'
|
|
|
|
########################################################################################################################
|
|
|
|
ROOT = './dist/'
|
|
|
|
########################################################################################################################
|
|
|
|
app = express()
|
|
|
|
app.get '/item(/*)?', (request, response)->
|
|
console.log ">>> index.html (for #{request.path})"
|
|
response.set 'Content-Type', 'text/html'
|
|
response.sendFile 'index.html', root:ROOT
|
|
|
|
app.get '/mod(/*)?', (request, response)->
|
|
console.log ">>> index.html (for #{request.path})"
|
|
response.set 'Content-Type', 'text/html'
|
|
response.sendFile 'index.html', root:ROOT
|
|
|
|
app.get '*', (request, response)->
|
|
extension = path.extname(request.path)
|
|
contentType = {
|
|
'.css': 'text/css'
|
|
'.html': 'text/html'
|
|
'.js': 'text/javascript'
|
|
'.json': 'application/json'
|
|
'.map': 'application/json'
|
|
'.png': 'image/png'
|
|
'.ttf': 'application/octet-stream'
|
|
'.scss': 'text/css'
|
|
}[extension]
|
|
console.log ">>> #{request.path}"
|
|
|
|
response.set 'Content-Type', contentType
|
|
response.sendFile request.path, root:ROOT
|
|
|
|
server = app.listen 8000, ->
|
|
console.log "listening at: #{server.address().address}:#{server.address().port}"
|