switch from api application to full-stack application

This commit is contained in:
Marco Zeisler
2020-04-06 20:34:45 +02:00
parent 068de731dc
commit 572e1f821c
72 changed files with 8464 additions and 352 deletions
+1 -19
View File
@@ -1,19 +1,6 @@
require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/engine"
require "action_view/railtie"
require "action_cable/engine"
# require "sprockets/railtie"
require "rails/test_unit/railtie"
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
@@ -28,10 +15,5 @@ module Tiss2go
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
# Only loads a smaller set of middleware suitable for API only apps.
# Middleware like session, flash, cookies can be added back manually.
# Skip views, helpers and assets when generating a new resource.
config.api_only = true
end
end
+1 -1
View File
@@ -1 +1 @@
//a2JoBrEdwktZ8ld1SCA9/HY8mECvsO7D2wMnTkI1vrGO/f6YukPMhWxQoxN2sraAEOlMBSEvhZBuph+9NcSv7yHZtrAE+jDQBuhFzYod2MR6xm7VBJAE/e5igRXY4t3XUXOB764OKMXE++XLmUglVMHfaaXmklqGfrVnG/k4xGP/Dr8R5ammpL9er8nKCEzSpmvKo+jnVVjPkm2Ku89ImDeBe+0Xw7n3QaeeZ3U39Y8h4xazGnyHdHeQPvMzO4jfa1uUWHrwZ6V3z93ghX012tC7i/WzRnvTaMTWOmmTl5/zbhr9CJNnHU4HrJlww6KO7CAvKM3u4dUG3nNkXMIUk8P1cEXaznVQ3zAS9loCPFNMCke7Ar38bpunbfqHvKjPY6NaZNDC7rs4pfU/c4m3kLBUxvLEqhIwbM--iSMU+cEHLW3vFiow--aFI1eZq6IPlsokp4+MPbLQ==
48vmrApqBGZdCnPpveHSdT2qpJjkibVXIfdanKKK2p/xSNn6zYjytUshxfe/72uV1uibwLtXAaKW7W1rBNFCWh2KycHNWNDbKMp4swSpOFWdCd821QvmghvV7RHAGlm9lJBjPpwT2s7sZUy4si+CooNVPQJ9Qu5egjkBGtgRd9mJy0IPG1rM7EzVLuq4NDYfoBFzz0ENVWiuZHMZ0if+8/xkAMGDa6G5DYG4sPEfZKY/XlVPiPnXIH1K6eFEk/YZlEu61r4krmBxPWzRE+S0Dk3dYcbluLuNDDpkwhF5eyL+JjWvyYcKPqeUTU0m261EEvAsI+pV3aJr3O31LTq/80ubNQYZeWA+kNTvf+ZoSzzTLINAV58+bZfi7/+m6KXKiN+TWLJ7El779sr2aKI0Pqf39LBwkz7QuIGf--J1dii4FxGjzY28MW--ehS76ZxyLo4nshG+eNE/tQ==
+11 -1
View File
@@ -15,6 +15,9 @@ Rails.application.configure do
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
@@ -42,11 +45,18 @@ Rails.application.configure do
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
+7
View File
@@ -12,6 +12,7 @@ Rails.application.configure do
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
@@ -21,6 +22,12 @@ Rails.application.configure do
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
+1 -1
View File
@@ -6,7 +6,7 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.cache_classes = false
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
+14
View File
@@ -0,0 +1,14 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,30 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # If you are using webpack-dev-server then specify webpack-dev-server host
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Set the nonce only to specific directives
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
-16
View File
@@ -1,16 +0,0 @@
# Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
# allow do
# origins 'example.com'
#
# resource '*',
# headers: :any,
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
# end
# end
+1 -1
View File
@@ -1 +1 @@
820db71b3797170d8a62f87109f13df5
c613ccf18a17c07b3d83e084b360f9c1
+1 -6
View File
@@ -1,9 +1,4 @@
Rails.application.routes.draw do
get 'login/index'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
# Listing resources
resources :courses
resources :people
resources :projects
resources :theses
end
-6
View File
@@ -1,6 +0,0 @@
Spring.watch(
".ruby-version",
".rbenv-vars",
"tmp/restart.txt",
"tmp/caching-dev.txt"
)
+5
View File
@@ -0,0 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const environment = require('./environment')
module.exports = environment.toWebpackConfig()
+3
View File
@@ -0,0 +1,3 @@
const { environment } = require('@rails/webpacker')
module.exports = environment
+5
View File
@@ -0,0 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const environment = require('./environment')
module.exports = environment.toWebpackConfig()
+5
View File
@@ -0,0 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const environment = require('./environment')
module.exports = environment.toWebpackConfig()
+96
View File
@@ -0,0 +1,96 @@
# Note: You must restart bin/webpack-dev-server for changes to take effect
default: &default
source_path: app/javascript
source_entry_path: packs
public_root_path: public
public_output_path: packs
cache_path: tmp/cache/webpacker
check_yarn_integrity: false
webpack_compile_output: true
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
# Extract and emit a css file
extract_css: false
static_assets_extensions:
- .jpg
- .jpeg
- .png
- .gif
- .tiff
- .ico
- .svg
- .eot
- .otf
- .ttf
- .woff
- .woff2
extensions:
- .mjs
- .js
- .sass
- .scss
- .css
- .module.sass
- .module.scss
- .module.css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
compile: true
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
check_yarn_integrity: true
# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
host: localhost
port: 3035
public: localhost:3035
hmr: false
# Inline should be set to true if using HMR
inline: true
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
pretty: false
headers:
'Access-Control-Allow-Origin': '*'
watch_options:
ignored: '**/node_modules/**'
test:
<<: *default
compile: true
# Compile test packs to a separate directory
public_output_path: packs-test
production:
<<: *default
# Production depends on precompilation of packs prior to booting for performance.
compile: false
# Extract and emit a css file
extract_css: true
# Cache manifest.json for performance
cache_manifest: true