commit
359b89b627
13 changed files with 5563 additions and 0 deletions
@ -0,0 +1,5 @@ |
|||||||
|
{ |
||||||
|
"projects": { |
||||||
|
"default": "uc-21006-backend" |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. |
||||||
|
|
||||||
|
# dependencies |
||||||
|
/node_modules |
||||||
|
/.pnp |
||||||
|
.pnp.js |
||||||
|
|
||||||
|
# testing |
||||||
|
/coverage |
||||||
|
|
||||||
|
# next.js |
||||||
|
/.next/ |
||||||
|
/out/ |
||||||
|
|
||||||
|
# production |
||||||
|
/build |
||||||
|
|
||||||
|
# misc |
||||||
|
.DS_Store |
||||||
|
*.pem |
||||||
|
.firebase/ |
||||||
|
|
||||||
|
# debug |
||||||
|
npm-debug.log* |
||||||
|
yarn-debug.log* |
||||||
|
yarn-error.log* |
||||||
|
|
||||||
|
# local env files |
||||||
|
.env.local |
||||||
|
.env.development.local |
||||||
|
.env.test.local |
||||||
|
.env.production.local |
||||||
|
|
||||||
|
# vercel |
||||||
|
.vercel |
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,24 @@ |
|||||||
|
{ |
||||||
|
"hosting": { |
||||||
|
"public": "public", |
||||||
|
"ignore": [ |
||||||
|
"firebase.json", |
||||||
|
"**/.*", |
||||||
|
"**/node_modules/**" |
||||||
|
], |
||||||
|
"rewrites": [ |
||||||
|
{ |
||||||
|
"source": "**", |
||||||
|
"function": "nextjsFunc" |
||||||
|
} |
||||||
|
] |
||||||
|
}, |
||||||
|
"functions": { |
||||||
|
"source": ".", |
||||||
|
"predeploy": [ |
||||||
|
"yarn", |
||||||
|
"yarn build" |
||||||
|
], |
||||||
|
"runtime": "nodejs14" |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
const { join } = require('path') |
||||||
|
const { https } = require('firebase-functions') |
||||||
|
const { default: next } = require('next') |
||||||
|
|
||||||
|
const nextjsDistDir = join('src', require('./src/next.config.js').distDir) |
||||||
|
|
||||||
|
const nextjsServer = next({ |
||||||
|
dev: false, |
||||||
|
conf: { |
||||||
|
distDir: nextjsDistDir, |
||||||
|
}, |
||||||
|
}) |
||||||
|
const nextjsHandle = nextjsServer.getRequestHandler() |
||||||
|
|
||||||
|
exports.nextjsFunc = https.onRequest((req, res) => { |
||||||
|
return nextjsServer.prepare().then(() => nextjsHandle(req, res)) |
||||||
|
}) |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
{ |
||||||
|
"private": true, |
||||||
|
"main": "firebaseFunctions.js", |
||||||
|
"scripts": { |
||||||
|
"dev": "next src/", |
||||||
|
"build": "next build src/", |
||||||
|
"start": "next start src/", |
||||||
|
"serve": "npm run build && firebase emulators:start --only functions,hosting", |
||||||
|
"shell": "npm run build && firebase functions:shell", |
||||||
|
"deploy": "firebase deploy --only functions,hosting", |
||||||
|
"logs": "firebase functions:log" |
||||||
|
}, |
||||||
|
"dependencies": { |
||||||
|
"firebase-admin": "^9.4.2", |
||||||
|
"firebase-functions": "^3.13.1", |
||||||
|
"next": "latest", |
||||||
|
"react": "^17.0.2", |
||||||
|
"react-dom": "^17.0.2" |
||||||
|
}, |
||||||
|
"devDependencies": { |
||||||
|
"firebase-functions-test": "^0.2.3", |
||||||
|
"firebase-tools": "^9.3.0" |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
import React from 'react' |
||||||
|
import Header from './Header' |
||||||
|
|
||||||
|
const App = ({ children }) => ( |
||||||
|
<main> |
||||||
|
<Header /> |
||||||
|
{children} |
||||||
|
</main> |
||||||
|
) |
||||||
|
|
||||||
|
export default App |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
import * as React from 'react' |
||||||
|
import Link from 'next/link' |
||||||
|
|
||||||
|
const Header = ({ pathname }) => ( |
||||||
|
<header> |
||||||
|
<Link href="/"> |
||||||
|
<a className={pathname === '/' ? 'is-active' : ''}>Home</a> |
||||||
|
</Link>{' '} |
||||||
|
<Link href="/about"> |
||||||
|
<a className={pathname === '/about' ? 'is-active' : ''}>About</a> |
||||||
|
</Link> |
||||||
|
</header> |
||||||
|
) |
||||||
|
|
||||||
|
export default Header |
||||||
@ -0,0 +1,3 @@ |
|||||||
|
module.exports = { |
||||||
|
distDir: '../.next', |
||||||
|
} |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
import App from '../components/App' |
||||||
|
|
||||||
|
export default function About() { |
||||||
|
return ( |
||||||
|
<App> |
||||||
|
<p>About Page</p> |
||||||
|
</App> |
||||||
|
) |
||||||
|
} |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
import App from '../components/App' |
||||||
|
|
||||||
|
export default function Home() { |
||||||
|
return ( |
||||||
|
<App> |
||||||
|
<p>Index Page</p> |
||||||
|
</App> |
||||||
|
) |
||||||
|
} |
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue