Seth Geoghegan
10/17/2021, 2:39 PMSeth Geoghegan
10/17/2021, 2:40 PMā dev npm init serverless-stack --example rest-api-dynamodb
Need to install the following packages:
create-serverless-stack
Ok to proceed? (y) y
Initializing a new Serverless Stack JavaScript project
Creating rest-api-dynamodb/ directory
Creating template for: javascript
Installing packages
npm WARN deprecated urix@0.1.0: Please see <https://github.com/lydell/urix#deprecated>
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: <https://github.com/lydell/resolve-url#deprecated>
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See <https://v8.dev/blog/math-random> for details.
npm WARN deprecated uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See <https://v8.dev/blog/math-random> for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see <https://github.com/request/request/issues/3142>
npm WARN deprecated node-pre-gyp@0.13.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
added 1592 packages, and audited 1617 packages in 1m
99 packages are looking for funding
run `npm fund` for details
31 vulnerabilities (2 moderate, 29 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Success! Created rest-api-dynamodb in /Users/sgeoghegan/dev/rest-api-dynamodb
You can run:
npm run start
Start the local development environment
npm run test
Run your tests
npm run build
Build your app and synthesize your stacks
npm run deploy
Deploy all your stacks and create your AWS resources
npm run remove
Remove all your stacks and all their resources from AWS
To get started:
cd rest-api-dynamodb
npm run start
Have fun!
ā dev cd rest-api-dynamodb
ā rest-api-dynamodb more stacks/MyStack.js
import * as sst from "@serverless-stack/resources";
export default class MyStack extends sst.Stack {
constructor(scope, id, props) {
super(scope, id, props);
// Create a HTTP API
const api = new sst.Api(this, "Api", {
routes: {
"GET /": "src/lambda.handler",
},
});
// Show the endpoint in the output
this.addOutputs({
"ApiEndpoint": api.url,
});
}
}
Seth Geoghegan
10/17/2021, 2:41 PMmore stacks/MyStack.js
to be the MyStack.js from the rest-api-dynamodb example repo, but that is not the case. What am I doing wrong?Seth Geoghegan
10/17/2021, 2:43 PM{
"name": "rest-api-dynamodb",
"version": "0.1.0",
"private": true,
"scripts": {
"test": "sst test",
"start": "sst start",
"build": "sst build",
"deploy": "sst deploy",
"remove": "sst remove"
},
"devDependencies": {
"@aws-cdk/assert": "1.126.0"
},
"dependencies": {
"@serverless-stack/cli": "0.46.1",
"@serverless-stack/resources": "0.46.1",
"@aws-cdk/core": "1.126.0"
}
}
manitej
10/17/2021, 4:12 PMnpm init serverless-stack@latest --example rest-api-dynamodb
or try using yarn
thdxr
10/17/2021, 4:57 PMthdxr
10/17/2021, 4:58 PMthdxr
10/17/2021, 4:58 PM--example=rest-api-dynamodb
the library we're using for flag parsing is getting confusedmanitej
10/17/2021, 5:09 PM=
?thdxr
10/17/2021, 5:11 PMSeth Geoghegan
10/17/2021, 5:25 PMSeth Geoghegan
10/18/2021, 1:09 PMnpx create-serverless-stack@latest --example=rest-api-dynamodb
as opposed to the instructions in the example repo, which were npm init serverless-stack --example=rest-api-dynamodb
Seth Geoghegan
10/18/2021, 1:11 PMcreate-serverless-stack
is the preferred way to download examples and npm init serverless-stack
was the previous method?