diff --git a/.gitignore b/.gitignore index c77ca9d..ea6337e 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,6 @@ yarn-error.log* # Archivos de desarrollo del servidor /srv/*/**.js -/srv/*/**.js.map \ No newline at end of file +/srv/*/**.js.map +deployarBackend.js +deployFrontEnd.js \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..800ad4e --- /dev/null +++ b/app.js @@ -0,0 +1,34 @@ +const fun = require("./srv/index").fun; + +const SPAhistory = require('connect-history-api-fallback'); +let express = require('express'); +const compresion = require('compression'); +const bodyParser = require('body-parser'); + +let app = express(); + +// History: Middleware para el routing de la SPA en modo history +// Por alguna razon solo funciona si lo uso antes de establecer el directorio estatico dist ... +app.use(SPAhistory()); +/* Compresion gzip */ +app.use(compresion()); + +app.use(express.static('dist')); + +app.use(express.urlencoded()); +app.use(express.json()); +app.use(bodyParser.json()); + +/* CORS para localhost y beta.pseudosubs.com */ + +app.all("*", (req, res, next) => { + res.header("Access-Control-Allow-Origin", "*"); + res.header('Access-Control-Allow-Headers', 'Content-Type'); + next(); +}); + +app.get("/"); + +fun(app); + +app.listen(8080, () => console.log("Iniciado en 8080")); \ No newline at end of file diff --git a/package.json b/package.json index 4195340..88ce67a 100644 --- a/package.json +++ b/package.json @@ -1,43 +1,55 @@ { - "name": "pseudosubs5", - "version": "0.1.0", - "private": true, - "scripts": { - "serve": "vue-cli-service serve", - "build": "vue-cli-service build", - "express": "vue-cli-service express:watch", - "express:run": "vue-cli-service express:run" - }, - "dependencies": { - "mysql": "^2.16.0", - "register-service-worker": "^1.6.2", - "vue": "^2.6.6", - "vue-disqus": "^3.0.5", - "vue-router": "^3.0.1", - "vuex": "^3.0.1", - "yaml": "^1.4.0" - }, - "devDependencies": { - "@vue/cli-plugin-babel": "^3.0.5", - "@vue/cli-plugin-pwa": "^3.0.5", - "@vue/cli-service": "^3.0.5", - "coffee-loader": "^0.9.0", - "coffeescript": "^2.3.2", - "node-sass": "^4.9.0", - "pug": "^2.0.3", - "pug-plain-loader": "^1.0.0", - "sass-loader": "^7.1.0", - "vue-cli-plugin-express": "^1.0.0", - "vue-template-compiler": "^2.5.21" - }, - "postcss": { - "plugins": { - "autoprefixer": {} - } - }, - "browserslist": [ - "> 1%", - "last 2 versions", - "not ie <= 8" - ] + "name": "pseudosubs5", + "version": "0.1.0", + "private": true, + "scripts": { + "start": "node app.js", + "serve": "vue-cli-service serve", + "build": "vue-cli-service build", + "express": "vue-cli-service express:watch", + "express:run": "vue-cli-service express:run" + }, + "dependencies": { + "compression": "^1.7.4", + "connect-history-api-fallback": "^1.6.0", + "express": "^4.16.4", + "mysql": "^2.17.1", + "register-service-worker": "^1.6.2", + "vue": "^2.6.6", + "vue-analytics": "^5.16.4", + "vue-disqus": "^3.0.5", + "vue-google-signin-button": "^1.0.2", + "vue-router": "^3.0.1", + "vuex": "^3.0.1", + "web-push": "^3.3.3", + "yaml": "^1.4.0" + }, + "devDependencies": { + "@types/express": "^4.16.1", + "@types/mysql": "^2.15.6", + "@vue/cli-plugin-babel": "^3.0.5", + "@vue/cli-plugin-pwa": "^3.0.5", + "@vue/cli-service": "^3.0.5", + "body-parser": "^1.19.0", + "coffee-loader": "^0.9.0", + "coffeescript": "^2.3.2", + "ftp-deploy": "^2.3.3", + "google-auth-library": "^3.1.2", + "node-sass": "^4.9.0", + "pug": "^2.0.3", + "pug-plain-loader": "^1.0.0", + "sass-loader": "^7.1.0", + "vue-cli-plugin-express": "^1.0.0", + "vue-template-compiler": "^2.5.21" + }, + "postcss": { + "plugins": { + "autoprefixer": {} + } + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 8" + ] } diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..4c05ff8 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,14 @@ + + + Header set Cache-Control "max-age=600, public" + + + + + RewriteEngine On + RewriteBase / + RewriteRule ^index\.html$ - [L] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . /index.html [L] + \ No newline at end of file diff --git a/public/index.html b/public/index.html index 86643f6..273b70d 100644 --- a/public/index.html +++ b/public/index.html @@ -8,6 +8,8 @@ PseudoSubs + +