mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 06:16:01 +00:00
add server task
This commit is contained in:
parent
b98bf5db11
commit
f975d22994
21
tasks/server.coffee
Normal file
21
tasks/server.coffee
Normal file
@ -0,0 +1,21 @@
|
||||
module.exports = (grunt) ->
|
||||
express = require("express")
|
||||
compression = require("compression")
|
||||
readYaml = require('read-yaml');
|
||||
|
||||
serverConfig = readYaml.sync("config/server.yml")
|
||||
|
||||
grunt.registerTask "server", "static file development server", =>
|
||||
webPort = serverConfig.port || 8000
|
||||
webHost = serverConfig.host || 'localhost'
|
||||
webRoot = "generated/dapp"
|
||||
|
||||
app = express()
|
||||
app.use(compression())
|
||||
app.use(express.static("" + (process.cwd()) + "/" + webRoot))
|
||||
app.listen(webPort, webHost)
|
||||
|
||||
grunt.log.writeln("Running web server on port http://#{webHost}:#{webPort}")
|
||||
|
||||
return app
|
||||
|
Loading…
x
Reference in New Issue
Block a user