Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/192 #193

Open
wants to merge 23 commits into
base: feature/187
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8fd44fb
feat(react client): added autogenerated react app
KoolTheba Mar 21, 2020
0f3fb39
feat(react api): added autogenerated express project
KoolTheba Mar 21, 2020
f7aebe7
chore(react api): upgraded dependencies
KoolTheba Mar 21, 2020
8b1884d
feat(react api): added config files
KoolTheba Mar 21, 2020
5034336
chore(files): updated gitignore rules
KoolTheba Mar 21, 2020
9ba3401
fix(react api): project name
KoolTheba Mar 21, 2020
0efe7f0
refactor(react api): ES6 migration
KoolTheba Mar 21, 2020
49493d9
refactor(react api): ES6 migration
KoolTheba Mar 21, 2020
67cefa0
feat(react api): added standard linter
KoolTheba Mar 21, 2020
d316b82
feat(react api): added lint git hook
KoolTheba Mar 21, 2020
bcaf6ef
chore(react api): files linted
KoolTheba Mar 21, 2020
414e602
feat(react api): added test environment
KoolTheba Mar 21, 2020
83e6b58
feat(react api): added test git hook
KoolTheba Mar 21, 2020
00bc5f3
chore(react api): update linting rules
KoolTheba Mar 21, 2020
e591970
feat(react api): added initial tests
KoolTheba Mar 21, 2020
fed2529
chore(react client): upgrade testing dependencies
KoolTheba Mar 22, 2020
a24718b
feat(react client): added linter to project
KoolTheba Mar 22, 2020
b77296b
feat(react client): added npm tasks for linting
KoolTheba Mar 22, 2020
780c963
chore(react client): files linted
KoolTheba Mar 22, 2020
fc07d62
WIP(react client): npm tasks for testing
KoolTheba Mar 22, 2020
2f07bf1
feat(react client): added styled component & material UI
KoolTheba Mar 22, 2020
25addff
feat(react client): added material ui icons
KoolTheba Mar 22, 2020
5731cd9
feat(react client): updated app component
KoolTheba Mar 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
316 changes: 305 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,317 @@
# Node modules
node_modules

# Logs and databases
*.log
*.db
# Created by https://www.gitignore.io/api/node,code,linux,macos,windows,webstorm,sublimetext
# Edit at https://www.gitignore.io/?templates=node,code,linux,macos,windows,webstorm,sublimetext

### Code ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# OS files
# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
Icon?
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# rollup.js default build output
dist/

# Uncomment the public line if your project uses Gatsby
# https://nextjs.org/blog/next-9-1#public-directory-support
# https://create-react-app.dev/docs/using-the-public-folder/#docsNav
# public

# Storybook build outputs
.out
.storybook-out

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# Idea stuff
.idea/**
# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Temporary folders
tmp/
temp/

### SublimeText ###
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# Workspace files are user-specific
*.sublime-workspace

# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
# *.sublime-project

# SFTP configuration file
sftp-config.json

# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache

# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings

### WebStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### WebStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/**/sonarlint/

# SonarQube Plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator/

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/node,code,linux,macos,windows,webstorm,sublimetext

# Logs and databases
*.log
*.db

# Zap output
report*.html
**/report*.html

# e2e
**/test/e2e/screenshots/
21 changes: 21 additions & 0 deletions apps/react-apirest/api/__test__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const supertest = require('supertest')
const app = require('../app')
const request = supertest(app)

describe('NodeGoat react apirest api', () => {
test('should handle NOT FOUND route', async done => {
const response = await request.get('/invented-route')

expect(response.status).toBe(404)
expect(response.body).toStrictEqual({ error: { message: 'Not Found' } })
done()
})

test('should handle API route', async done => {
const response = await request.get('/api/v1/')

expect(response.status).toBe(200)
expect(response.body).toStrictEqual({ msg: 'respond with a resource' })
done()
})
})
28 changes: 28 additions & 0 deletions apps/react-apirest/api/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const createError = require('http-errors')
const express = require('express')
const cookieParser = require('cookie-parser')
const logger = require('morgan')

const apiRouter = require('./routes/api')

const app = express()

app.use(logger('dev'))
app.use(express.json())
app.use(express.urlencoded({ extended: false }))
app.use(cookieParser())

app.use('/api/v1', apiRouter)

// catch 404 and forward to error handler
app.use((req, res, next) => {
next(createError(404))
})

// error handler
app.use((error, req, res, next) => {
res.status(error.status || 500)
res.json({ error })
})

module.exports = app
Loading