Skip to content

Commit

Permalink
Prepare app for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
marcnjaramillo committed Apr 28, 2020
1 parent b9a9045 commit 8ab3b6c
Show file tree
Hide file tree
Showing 51 changed files with 1,250 additions and 2 deletions.
43 changes: 43 additions & 0 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"apollo-server-express": "^2.9.16",
"body-parser": "^1.19.0",
"cloudinary": "^1.19.0",
"compression": "^1.7.4",
"cookie-parser": "^1.4.4",
"express": "^4.17.1",
"googleapis": "^47.0.0",
Expand All @@ -24,6 +25,7 @@
},
"devDependencies": {
"@types/body-parser": "^1.17.1",
"@types/compression": "^1.7.0",
"@types/cookie-parser": "^1.4.2",
"@types/dotenv": "^8.2.0",
"@types/express": "^4.17.2",
Expand Down
9 changes: 7 additions & 2 deletions server/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
require('dotenv').config();
//require('dotenv').config();

import express, { Application } from 'express';
import bodyParser from 'body-parser';
import cookieParser from 'cookie-parser';
import { ApolloServer } from 'apollo-server-express';
import { connectDatabase } from './database';
import { typeDefs, resolvers } from './graphql';
import compression from 'compression';

const mount = async (app: Application) => {
const db = await connectDatabase();

app.use(bodyParser.json({ limit: '2mb' }));
app.use(cookieParser(process.env.SECRET));
app.use(compression());

app.use(express.static(`${__dirname}/client`));
app.get('/*', (_req, res) => res.sendFile(`${__dirname}/client/index.html`));

const server = new ApolloServer({
typeDefs,
resolvers,
context: ({ req, res }) => ({ db, req, res })
context: ({ req, res }) => ({ db, req, res }),
});

server.applyMiddleware({ app, path: '/api' });
Expand Down
15 changes: 15 additions & 0 deletions tinyhouse-deploy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# dependencies
node_modules/

# production
build/

# misc
.DS_Store

# environment variables
.env

npm-debug.log*
yarn-debug.log*
yarn-error.log*
24 changes: 24 additions & 0 deletions tinyhouse-deploy/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "tinyhouse-deploy",
"version": "0.1.0",
"private": true,
"engines": {
"node": "13.6.0"
},
"dependencies": {
"@google/maps": "^1.0.2",
"apollo-server-express": "^2.6.4",
"body-parser": "^1.19.0",
"cloudinary": "^1.17.0",
"cookie-parser": "^1.4.4",
"express": "^4.17.1",
"googleapis": "^42.0.0",
"graphql": "^14.3.1",
"lodash.merge": "^4.6.2",
"mongodb": "^3.2.7",
"stripe": "^7.13.1"
},
"scripts": {
"start": "node src/index.js"
}
}
32 changes: 32 additions & 0 deletions tinyhouse-deploy/src/client/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"files": {
"main.css": "/static/css/main.7a968d50.chunk.css",
"main.js": "/static/js/main.d636ddfd.chunk.js",
"main.js.map": "/static/js/main.d636ddfd.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.ca47c4cd.js",
"runtime-main.js.map": "/static/js/runtime-main.ca47c4cd.js.map",
"static/css/2.c11cfb7b.chunk.css": "/static/css/2.c11cfb7b.chunk.css",
"static/js/2.4184fe11.chunk.js": "/static/js/2.4184fe11.chunk.js",
"static/js/2.4184fe11.chunk.js.map": "/static/js/2.4184fe11.chunk.js.map",
"index.html": "/index.html",
"precache-manifest.662cbae5dd77a951f2d584284736662e.js": "/precache-manifest.662cbae5dd77a951f2d584284736662e.js",
"service-worker.js": "/service-worker.js",
"static/css/2.c11cfb7b.chunk.css.map": "/static/css/2.c11cfb7b.chunk.css.map",
"static/css/main.7a968d50.chunk.css.map": "/static/css/main.7a968d50.chunk.css.map",
"static/js/2.4184fe11.chunk.js.LICENSE.txt": "/static/js/2.4184fe11.chunk.js.LICENSE.txt",
"static/media/cancun.jpg": "/static/media/cancun.cd98e2c3.jpg",
"static/media/dubai.jpg": "/static/media/dubai.df994899.jpg",
"static/media/london.jpg": "/static/media/london.841651c3.jpg",
"static/media/los-angeles.jpg": "/static/media/los-angeles.73d8ec96.jpg",
"static/media/map-background.jpg": "/static/media/map-background.c21df147.jpg",
"static/media/san-fransisco.jpg": "/static/media/san-fransisco.23aadf81.jpg",
"static/media/toronto.jpg": "/static/media/toronto.3c573d34.jpg"
},
"entrypoints": [
"static/js/runtime-main.ca47c4cd.js",
"static/css/2.c11cfb7b.chunk.css",
"static/js/2.4184fe11.chunk.js",
"static/css/main.7a968d50.chunk.css",
"static/js/main.d636ddfd.chunk.js"
]
}
Binary file added tinyhouse-deploy/src/client/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions tinyhouse-deploy/src/client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Tinyhouse</title><script src="https://js.stripe.com/v3/"></script><link href="/static/css/2.c11cfb7b.chunk.css" rel="stylesheet"><link href="/static/css/main.7a968d50.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,l=t[0],f=t[1],a=t[2],p=0,s=[];p<l.length;p++)i=l[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(t);s.length;)s.shift()();return u.push.apply(u,a||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,l=1;l<r.length;l++){var f=r[l];0!==o[f]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/";var l=this["webpackJsonptinyhouse-client"]=this["webpackJsonptinyhouse-client"]||[],f=l.push.bind(l);l.push=t,l=l.slice();for(var a=0;a<l.length;a++)t(l[a]);var c=f;r()}([])</script><script src="/static/js/2.4184fe11.chunk.js"></script><script src="/static/js/main.d636ddfd.chunk.js"></script></body></html>
Binary file added tinyhouse-deploy/src/client/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tinyhouse-deploy/src/client/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions tinyhouse-deploy/src/client/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "de49d37b03c8344315f0e50d58bdf82f",
"url": "/index.html"
},
{
"revision": "579302d7c2242acd570f",
"url": "/static/css/2.c11cfb7b.chunk.css"
},
{
"revision": "747d051b85d35facf782",
"url": "/static/css/main.7a968d50.chunk.css"
},
{
"revision": "579302d7c2242acd570f",
"url": "/static/js/2.4184fe11.chunk.js"
},
{
"revision": "8e87f68634b1e5b84f6f7c9aeab3aa68",
"url": "/static/js/2.4184fe11.chunk.js.LICENSE.txt"
},
{
"revision": "747d051b85d35facf782",
"url": "/static/js/main.d636ddfd.chunk.js"
},
{
"revision": "d230685fb04f7ab82483",
"url": "/static/js/runtime-main.ca47c4cd.js"
},
{
"revision": "cd98e2c39b50532ef09a3344e820499f",
"url": "/static/media/cancun.cd98e2c3.jpg"
},
{
"revision": "df994899b2925871e24126812c416c24",
"url": "/static/media/dubai.df994899.jpg"
},
{
"revision": "841651c32f46a04c181eb090a32bd103",
"url": "/static/media/london.841651c3.jpg"
},
{
"revision": "73d8ec963252e42850a528642374f476",
"url": "/static/media/los-angeles.73d8ec96.jpg"
},
{
"revision": "c21df1475cabff80a179b3c0cd49dd67",
"url": "/static/media/map-background.c21df147.jpg"
},
{
"revision": "23aadf8146a0240ddc18f846d8c64843",
"url": "/static/media/san-fransisco.23aadf81.jpg"
},
{
"revision": "3c573d340e505c3f2f5b60c34b20aacc",
"url": "/static/media/toronto.3c573d34.jpg"
}
]);
2 changes: 2 additions & 0 deletions tinyhouse-deploy/src/client/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
39 changes: 39 additions & 0 deletions tinyhouse-deploy/src/client/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/

importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"/precache-manifest.662cbae5dd77a951f2d584284736662e.js"
);

self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});

workbox.core.clientsClaim();

/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), {

blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
});
18 changes: 18 additions & 0 deletions tinyhouse-deploy/src/client/static/css/2.c11cfb7b.chunk.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 8ab3b6c

Please sign in to comment.