https://github.com/siyer2/sam-express-template
A simple template that allows you to use Typescript Express to create a serverless REST API
https://github.com/siyer2/sam-express-template
aws express rest-api sam serverless typescript
Last synced: about 2 months ago
JSON representation
A simple template that allows you to use Typescript Express to create a serverless REST API
- Host: GitHub
- URL: https://github.com/siyer2/sam-express-template
- Owner: Siyer2
- Created: 2023-01-18T00:05:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-18T00:36:20.000Z (over 3 years ago)
- Last Synced: 2025-06-01T15:47:32.214Z (about 1 year ago)
- Topics: aws, express, rest-api, sam, serverless, typescript
- Language: TypeScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SAM Express template
This is a simple template that allows you to create a Typescript Express REST API and deploy it AWS Lambda and API Gateway.
## Benefits
- Use traditional Express syntax (e.g. `app.get("/hello"...`) rather than having a `handler` per endpoint like [this](https://github.com/aws/aws-sam-cli-app-templates/blob/master/nodejs18.x/hello-ts/%7B%7Bcookiecutter.project_name%7D%7D/hello-world/app.ts)
- Makes it easier to migrate to Dockerise (useful if you wanted to migrate to ECS)
- Simplifies local development
- Built with [esbuild](https://esbuild.github.io/) (billed as being 10-100x faster than other build tools)
## Running it locally
```
$ cd src
$ npm install
$ npm start
```
### Running it locally with SAM
(AWS SAM can be installed [here](https://aws.amazon.com/serverless/sam/))
You can also run it locally to _exactly_ match the configuation in the template.yml (e.g. to make it adhere to the set timeout, memory limit etc.)
```
$ sam build
$ sam local start-api
```
## Deploying it
```
$ sam build
$ sam deploy --guided
```
Following a successful deployment, the endpoint URL will get printed in the terminal.
Note: When doing `--guided`, you can follow the instructions. It will store your preferences in a `samconfig.toml` so you can just do a `sam deploy` in the future.