New skeleton web app
This commit is contained in:
commit
75d7e85454
10 files changed
+102
No files matched your search
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "script"
|
||||||
|
},
|
||||||
|
"plugins": ["prettier"],
|
||||||
|
"rules": {
|
||||||
|
"no-shadow": ["error", { "allow": ["err"] }],
|
||||||
|
"handle-callback-err": "error",
|
||||||
|
"prefer-arrow-callback": "error",
|
||||||
|
"curly": ["error", "multi", "consistent"],
|
||||||
|
"prettier/prettier": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"commonjs": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const m = require("mithril");
|
||||||
|
|
||||||
|
m.render(document.body, "hello world");
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "genieacs-ui",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"lint": "eslint --fix server/*.js client/*.js",
|
||||||
|
"build": "webpack",
|
||||||
|
"start": "npm run lint;npm run build;node server/server"
|
||||||
|
},
|
||||||
|
"author": "Zaid Abdulla <zaid@genieacs.com>",
|
||||||
|
"dependencies": {
|
||||||
|
"koa": "^2.4.1",
|
||||||
|
"koa-bodyparser": "^4.2.0",
|
||||||
|
"koa-router": "^7.3.0",
|
||||||
|
"koa-static": "^4.0.2",
|
||||||
|
"mithril": "^1.1.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^4.12.1",
|
||||||
|
"eslint-plugin-prettier": "^2.3.1",
|
||||||
|
"prettier": "^1.8.2",
|
||||||
|
"webpack": "^3.9.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script src="app.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Router = require("koa-router");
|
||||||
|
|
||||||
|
const router = new Router();
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.PORT = 3000;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Koa = require("koa");
|
||||||
|
const Router = require("koa-router");
|
||||||
|
const koaStatic = require("koa-static");
|
||||||
|
|
||||||
|
const config = require("./config");
|
||||||
|
const api = require("./api");
|
||||||
|
|
||||||
|
const koa = new Koa();
|
||||||
|
const router = new Router();
|
||||||
|
|
||||||
|
router.use("/api", api.routes(), api.allowedMethods());
|
||||||
|
|
||||||
|
koa.use(router.routes());
|
||||||
|
koa.use(koaStatic("./public"));
|
||||||
|
|
||||||
|
koa.listen(config.PORT, () => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`Server listening on port ${config.PORT}`);
|
||||||
|
});
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
entry: "./client/app.js",
|
||||||
|
output: {
|
||||||
|
filename: "public/app.js"
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in new issue
Block a user