-
-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrading to use starter and Node v8.10 (#222)
* Updating to use starter * Editing
- Loading branch information
Showing
8 changed files
with
84 additions
and
104 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
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
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
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
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 |
---|---|---|
|
@@ -3,16 +3,17 @@ layout: post | |
title: Serverless Node.js Starter | ||
redirect_from: /chapters/serverless-es7-service.html | ||
date: 2017-05-30 00:00:00 | ||
description: A Serverless Node.js starter project that adds support for ES6/ES7 async/await methods and unit tests to your Serverless Framework project. | ||
description: A Serverless Node.js starter project that adds support for ES6/ES7 async/await methods, import/export, and unit tests to your Serverless Framework project. | ||
context: all | ||
comments_id: 72 | ||
--- | ||
|
||
Now that we know how to set our Serverless projects up, it makes sense that we have a good starting point for our future projects. For this we created a couple of Serverless starter projects that you can use called, [Serverless Node.js Starter](https://github.com/AnomalyInnovations/serverless-nodejs-starter). We also have a Python version called [Serverless Python Starter](https://github.com/AnomalyInnovations/serverless-python-starter). Our starter projects also work really well with [Seed](https://seed.run); a fully-configured CI/CD pipeline for Serverless Framework. | ||
Based on what we have gone through in this guide, it makes sense that we have a good starting point for our future projects. For this we created a couple of Serverless starter projects that you can use called, [Serverless Node.js Starter](https://github.com/AnomalyInnovations/serverless-nodejs-starter). We also have a Python version called [Serverless Python Starter](https://github.com/AnomalyInnovations/serverless-python-starter). Our starter projects also work really well with [Seed](https://seed.run); a fully-configured CI/CD pipeline for Serverless Framework. | ||
|
||
[Serverless Node.js Starter](https://github.com/AnomalyInnovations/serverless-nodejs-starter) uses the [serverless-webpack](https://github.com/serverless-heaven/serverless-webpack) plugin, the [serverless-offline](https://github.com/dherault/serverless-offline) plugin, [Babel](https://babeljs.io), and [Jest](https://facebook.github.io/jest/). It supports: | ||
|
||
- **Use async/await in your handler functions** | ||
- **Use ES7 syntax in your handler functions** | ||
- **Package your functions using Webpack** | ||
- **Run API Gateway locally** | ||
- Use `serverless offline start` | ||
- **Support for unit tests** | ||
|
@@ -57,7 +58,7 @@ const message = ({ time, ...rest }) => new Promise((resolve, reject) => | |
|
||
### Installation | ||
|
||
To create a new Serverless project with ES7 support. | ||
To create a new Serverless project. | ||
|
||
``` bash | ||
$ serverless install --url https://github.com/AnomalyInnovations/serverless-nodejs-starter --name my-project | ||
|
@@ -117,5 +118,3 @@ To add environment variables to your project | |
4. Make sure to not commit your `env.yml`. | ||
|
||
So give it a try and send us an [email](mailto:[email protected]) if you have any questions or open a [new issue](https://github.com/AnomalyInnovations/serverless-nodejs-starter/issues/new) if you've found a bug. | ||
|
||
|
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
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 |
---|---|---|
|
@@ -18,12 +18,14 @@ To be able to hit our API endpoints securely, we need to follow these steps. | |
|
||
These steps can be a bit tricky to do by hand. So we created a simple tool called [AWS API Gateway Test CLI](https://github.com/AnomalyInnovations/aws-api-gateway-cli-test). | ||
|
||
You can install it by running the following. | ||
You can run it using. | ||
|
||
``` bash | ||
$ npm install -g aws-api-gateway-cli-test | ||
$ npx aws-api-gateway-cli-test | ||
``` | ||
|
||
The `npx` command is just a convenient way of running a NPM module without installing it globally. | ||
|
||
We need to pass in quite a bit of our info to complete the above steps. | ||
|
||
- Use the username and password of the user created in the [Create a Cognito test user]({% link _chapters/create-a-cognito-test-user.md %}) chapter. | ||
|
@@ -34,7 +36,7 @@ We need to pass in quite a bit of our info to complete the above steps. | |
And run the following. | ||
|
||
``` bash | ||
$ apig-test \ | ||
$ npx aws-api-gateway-cli-test \ | ||
--username='[email protected]' \ | ||
--password='Passw0rd!' \ | ||
--user-pool-id='YOUR_COGNITO_USER_POOL_ID' \ | ||
|
@@ -53,7 +55,7 @@ While this might look intimidating, just keep in mind that behind the scenes all | |
If you are on Windows, use the command below. The space between each option is very important. | ||
|
||
``` bash | ||
$ apig-test --username [email protected] --password Passw0rd! --user-pool-id YOUR_COGNITO_USER_POOL_ID --app-client-id YOUR_COGNITO_APP_CLIENT_ID --cognito-region YOUR_COGNITO_REGION --identity-pool-id YOUR_IDENTITY_POOL_ID --invoke-url YOUR_API_GATEWAY_URL --api-gateway-region YOUR_API_GATEWAY_REGION --path-template /notes --method POST --body "{\"content\":\"hello world\",\"attachment\":\"hello.jpg\"}" | ||
$ npx aws-api-gateway-cli-test --username [email protected] --password Passw0rd! --user-pool-id YOUR_COGNITO_USER_POOL_ID --app-client-id YOUR_COGNITO_APP_CLIENT_ID --cognito-region YOUR_COGNITO_REGION --identity-pool-id YOUR_IDENTITY_POOL_ID --invoke-url YOUR_API_GATEWAY_URL --api-gateway-region YOUR_API_GATEWAY_REGION --path-template /notes --method POST --body "{\"content\":\"hello world\",\"attachment\":\"hello.jpg\"}" | ||
``` | ||
|
||
If the command is successful, the response will look similar to this. | ||
|
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