forked from finos/morphir-elm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of dev server. finos#33
- Loading branch information
1 parent
4f60a79
commit 1ec34c4
Showing
14 changed files
with
414 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ node_modules | |
elm-stuff | ||
.vscode | ||
.idea | ||
dist/ | ||
dist/ | ||
morphir-ir.json | ||
tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Morphir.*.js | ||
Morphir.*.js | ||
web/main.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
|
||
// NPM imports | ||
const path = require('path') | ||
const commander = require('commander') | ||
const express = require('express') | ||
const cli = require('./cli') | ||
|
||
// Set up Commander | ||
const program = new commander.Command() | ||
program | ||
.name('morphir-elm develop') | ||
.description('Start up a web server and expose developer tools through a web UI') | ||
.option('-p, --project-dir <path>', 'Root directory of the project where morphir.json is located.', '.') | ||
.parse(process.argv) | ||
|
||
const app = express() | ||
const port = 3000 | ||
|
||
app.get('/', (req, res) => { | ||
res.redirect('index.html') | ||
}) | ||
|
||
app.use(express.static(path.join(__dirname, 'web'))) | ||
|
||
app.get('/server/make', (req, res) => { | ||
cli.make(program.projectDir) | ||
.then((packageDef) => { | ||
res.send(['ok', packageDef]) | ||
}) | ||
.catch((err) => { | ||
res.send(['err', err]) | ||
}) | ||
}) | ||
|
||
app.listen(port, () => { | ||
console.log(`Developer server listening at http://localhost:${port}`) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.