-
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.
created boilerplate express server integrated with electron
- Loading branch information
Showing
14 changed files
with
188 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "public/lib" | ||
} |
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 |
---|---|---|
|
@@ -31,3 +31,5 @@ node_modules | |
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
public/lib/* |
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,6 @@ | ||
{ | ||
"esversion": 6, | ||
"strict": true, | ||
"esnext": false, | ||
"node": true | ||
} |
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,21 @@ | ||
{ | ||
"name": "dashbored", | ||
"description": "Dashbored is an all-in-one dashboard for users to keep notes, track the weather, get news updates, etc. Built with Express, Angular, Node, and SQLite.", | ||
"main": "server.js", | ||
"authors": [ | ||
"“Emma <“[email protected]”>" | ||
], | ||
"license": "MIT", | ||
"homepage": "https://github.com/beatface/dashbored", | ||
"moduleType": [], | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies": { | ||
"angular": "^1.5.0" | ||
} | ||
} |
Empty file.
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,50 @@ | ||
{ | ||
"name": "dashbored", | ||
"version": "1.0.0", | ||
"description": "Dashbored is an all-in-one dashboard for users to keep notes, track the weather, get news updates, etc. Built with Express, Angular, Node, and SQLite.", | ||
"main": "server.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "electron server.js", | ||
"dev": "NODE_ENV=development electron server.js", | ||
"bower": "./node_modules/bower/bin/bower" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/beatface/dashbored.git" | ||
}, | ||
"keywords": [], | ||
"author": "“Emma <“[email protected]”>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/beatface/dashbored/issues" | ||
}, | ||
"eslintConfig": { | ||
"env": { | ||
"node": true, | ||
"es6": true, | ||
"browser": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"globals": { | ||
"res": true, | ||
"next": true | ||
}, | ||
"rules": { | ||
"no-console": 0, | ||
"comma-dangle": 0 | ||
} | ||
}, | ||
"homepage": "https://github.com/beatface/dashbored#readme", | ||
"dependencies": { | ||
"body-parser": "^1.15.0", | ||
"electron-prebuilt": "^0.36.10", | ||
"express": "^4.13.4", | ||
"jade": "^1.11.0", | ||
"node-sass-middleware": "^0.9.7" | ||
}, | ||
"devDependencies": { | ||
"bower": "^1.7.7", | ||
"nodemon": "^1.9.1" | ||
} | ||
} |
Empty file.
Empty file.
Empty file.
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,11 @@ | ||
"use strict"; | ||
|
||
const express = require('express'); | ||
const router = express.Router(); | ||
|
||
router.get('/', (req, res) => { | ||
res.send('This seems to be working!'); | ||
}); | ||
|
||
|
||
module.exports = router; |
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,80 @@ | ||
"use strict"; | ||
|
||
const electron = require('electron'); | ||
const electronApp = electron.app; | ||
const BrowserWindow = electron.BrowserWindow; | ||
|
||
const express = require('express'); | ||
const path = require('path'); | ||
const app = express(); | ||
const PORT = process.env.PORT || 3153; | ||
|
||
// Express routes, views, ctrls | ||
const routes = require('./routes/'); | ||
|
||
// Keep a global reference of the window object, if you don't, the window will | ||
// be closed automatically when the JavaScript object is garbage collected. | ||
var mainWindow = null; | ||
|
||
// Quit when all windows are closed. | ||
electronApp.on('window-all-closed', function() { | ||
// On OS X it is common for applications and their menu bar | ||
// to stay active until the user quits explicitly with Cmd + Q | ||
if (process.platform != 'darwin') { | ||
electronApp.quit(); | ||
} | ||
}); | ||
|
||
app.use(express.static(path.join(__dirname, 'public'))); | ||
// view engine setup | ||
app.set('views', path.join(__dirname, 'views')); | ||
app.set('view engine', 'jade'); | ||
app.use(routes); | ||
|
||
// This method will be called when Electron has finished | ||
// initialization and is ready to create browser windows. | ||
electronApp.on('ready', function() { | ||
// Create the browser window. | ||
mainWindow = new BrowserWindow({ | ||
autoHideMenuBar: true, | ||
webPreferences: { | ||
nodeIntegration: false | ||
}, | ||
width: 840, | ||
height: 600 | ||
}); | ||
|
||
// development error handler | ||
// will print stacktrace | ||
if (process.env.NODE_ENV === 'development') { | ||
app.use(function(err, req, res) { | ||
res.status(err.status || 500); | ||
res.render('error', { | ||
message: err.message, | ||
error: err | ||
}); | ||
}); | ||
} | ||
|
||
// production error handler | ||
// no stacktraces leaked to user | ||
app.use(function(err, req, res) { | ||
res.status(err.status || 500); | ||
res.render('error', { | ||
message: err.message, | ||
error: {} | ||
}); | ||
}); | ||
|
||
app.listen(PORT, () => { | ||
// and load the index.html of the electronApp. | ||
mainWindow.loadURL('http://127.0.0.1:3153'); | ||
// Open the DevTools. | ||
mainWindow.webContents.openDevTools(); | ||
}); | ||
|
||
// closes server when window is closed | ||
mainWindow.on('closed', function() { | ||
mainWindow = null; | ||
}); | ||
}); |
Empty file.
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,6 @@ | ||
extends template.jade | ||
|
||
block content | ||
h1= message | ||
h2= error.status | ||
pre #{error.stack} |
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,9 @@ | ||
|
||
doctype html | ||
html(lang="en") | ||
head | ||
title= title | ||
link(rel='stylesheet', href='/stylesheets/style.css') | ||
//- script(src="/components/jquery/dist/jquery.min.js") | ||
body | ||
block content |