From f4a7370c5efc591e5d1aa18c21fa307950444217 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sun, 26 Feb 2023 15:20:36 +0100 Subject: [PATCH] lint, git, circleci, basics --- .circleci/config.yml | 24 ++++++++++++++++++++++++ .eslintrc.js | 9 +++++++++ .gitignore | 14 ++++++++++++++ projectWebsite/index.html | 13 ++++++++++++- app.js => server/app.js | 24 +++++++++++++++++++++--- 5 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 .gitignore rename app.js => server/app.js (68%) diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6c2f67a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,24 @@ +version: 2.1 +orbs: + node: circleci/node@5.1.0 + +jobs: + build_and_test: + executor: node/default + steps: + - checkout + - node/install-packages: + pkg-manager: npm + - run: + command: npm run build + name: Build app + - run: + command: npm run test + name: Run tests + - run: + command: npm run build-website + name: Build documentation + - persist_to_workspace: + root: ~/project + paths: + - . \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index 7b676c3..87eb22d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,12 @@ +/* +* myevent - .eslintrc.js +* +* Created by Janis Hutz 02/26/2023, Licensed under the GPL V3 License +* https://janishutz.com, development@janishutz.com +* +* +*/ + module.exports = { 'env': { 'browser': true, diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b3cb07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# +# myevent - .gitignore +# +# Created by Janis Hutz 02/26/2023, Licensed under the GPL V3 License +# https://janishutz.com, development@janishutz.com +# +# + + +# ignore ALL .log files +*.log + +# ignore node_modules (can be rebuilt with npm i --> shrinks repo size) +node_modules \ No newline at end of file diff --git a/projectWebsite/index.html b/projectWebsite/index.html index 763b073..d0e2960 100644 --- a/projectWebsite/index.html +++ b/projectWebsite/index.html @@ -1 +1,12 @@ - \ No newline at end of file + + + + myevent - Free & Open Source event management solution + + + + + +

+ + \ No newline at end of file diff --git a/app.js b/server/app.js similarity index 68% rename from app.js rename to server/app.js index 3365410..f97aa5c 100644 --- a/app.js +++ b/server/app.js @@ -1,3 +1,12 @@ +/* +* myevent - app.js +* +* Created by Janis Hutz 02/26/2023, Licensed under the GPL V3 License +* https://janishutz.com, development@janishutz.com +* +* +*/ + const express = require( 'express' ); let app = express(); const path = require( 'path' ); @@ -8,24 +17,33 @@ const cookieParser = require( 'cookie-parser' ); const favicon = require( 'serve-favicon' ); const http = require( 'http' ); +const env = process.env.PROD || false; + +const root = process.env.ROOT || '/order'; + +// initialise express with middlewares app.use( expressSession( { secret: 'gaoevgoawefgo083tq2rfvöfaf0p8', resave: true, saveUninitialized: true } ) ); + app.use( bodyParser.urlencoded( { extended: false } ) ); app.use( bodyParser.json() ); app.use( cookieParser() ); app.use( favicon( path.join( __dirname + '/ui/assets/logo.png' ) ) ); +// create 404 handler app.use( ( request, response ) => { response.sendFile( path.join( __dirname + '' ) ); } ); -app.get( '/', ( request, response ) => { - -} ); +if ( root !== '/' ) { + app.get( '/', ( request, response ) => { + + } ); +} const PORT = process.env.PORT || 8080;