-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dabit
committed
Aug 24, 2018
0 parents
commit 52fb936
Showing
25 changed files
with
22,307 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Project dependencies | ||
.cache | ||
node_modules | ||
yarn-error.log | ||
|
||
# Build directory | ||
/public | ||
.DS_Store | ||
|
||
# aws | ||
.amplifyrc | ||
amplify | ||
src/aws-exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 gatsbyjs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Gatsby Auth Starter AWS | ||
Gatsby starter with user authentication using Amazon Cognito. | ||
|
||
## Getting Started | ||
|
||
1. Download the project | ||
|
||
```sh | ||
git clone https://github.com/dabit3/gatsby-auth-starter-aws.git | ||
``` | ||
|
||
2. Change into the new directory | ||
|
||
```sh | ||
cd gatsby-auth-starter | ||
``` | ||
|
||
3. Change into the new directory | ||
|
||
```sh | ||
yarn | ||
# or | ||
npm install | ||
``` | ||
|
||
4. Install & configure the AWS Amplify CLI | ||
|
||
```sh | ||
npm i -g @aws-amplify/cli | ||
|
||
amplify configure | ||
``` | ||
|
||
> To see a video of how to configure the CLI, click [here](https://www.youtube.com/watch?v=fWbM5DLh25U) | ||
5. Create a new AWS Amplify Project | ||
|
||
> If you don't already have the AWS Amplify CLI installed & configured, click [here](https://aws-amplify.github.io/amplify-js/index.html) to do so. | ||
``` | ||
amplify init | ||
``` | ||
|
||
6. Add authentication to your AWS Aplify project (Accept all defaults) | ||
|
||
```sh | ||
amplify auth add | ||
``` | ||
|
||
7. Publish the updated project configuration to AWS | ||
|
||
```sh | ||
amplify publish | ||
``` | ||
|
||
8. Then you can run it by: | ||
```sh | ||
gatsby develop | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Implement Gatsby's Browser APIs in this file. | ||
* | ||
* See: https://www.gatsbyjs.org/docs/browser-apis/ | ||
*/ | ||
|
||
// You can delete this file if you're not using it | ||
|
||
import Auth from '@aws-amplify/auth' | ||
import { setUser } from './src/utils/auth' | ||
|
||
export const onRouteUpdate = (state, page, pages) => { | ||
Auth.currentAuthenticatedUser() | ||
.then(user => { | ||
const userInfo = { | ||
...user.attributes, | ||
username: user.username | ||
} | ||
setUser(userInfo) | ||
}) | ||
.catch(err => { | ||
window.localStorage.setItem('gatsbyUser', null) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
siteMetadata: { | ||
title: 'Gatsby Auth Starter AWS', | ||
}, | ||
plugins: [ | ||
'gatsby-plugin-react-helmet', | ||
{ | ||
resolve: `gatsby-plugin-manifest`, | ||
options: { | ||
name: 'gatsby-starter-default', | ||
short_name: 'starter', | ||
start_url: '/', | ||
background_color: '#663399', | ||
theme_color: '#663399', | ||
display: 'minimal-ui', | ||
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site. | ||
}, | ||
}, | ||
'gatsby-plugin-offline', | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Implement Gatsby's Node APIs in this file. | ||
* | ||
* See: https://www.gatsbyjs.org/docs/node-apis/ | ||
*/ | ||
|
||
// You can delete this file if you're not using it | ||
exports.onCreatePage = async ({ page, actions }) => { | ||
const { createPage } = actions | ||
|
||
// page.matchPath is a special key that's used for matching pages | ||
// only on the client. | ||
if (page.path.match(/^\/app/)) { | ||
page.matchPath = `/app/*` | ||
|
||
// Update the page. | ||
createPage(page) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file. | ||
* | ||
* See: https://www.gatsbyjs.org/docs/ssr-apis/ | ||
*/ | ||
|
||
// You can delete this file if you're not using it |
Oops, something went wrong.