Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thesmartmonkey/create-serverless-simple-ts-service

Template of a simple serverless typescript api service with dynamodb
https://github.com/thesmartmonkey/create-serverless-simple-ts-service

aws-lambda aws-lambda-node serverless serverless-framework typescript

Last synced: about 17 hours ago
JSON representation

Template of a simple serverless typescript api service with dynamodb

Awesome Lists containing this project

README

        

# Serverless simple typescript service template

Template of a simple serverless typescript api service with dynamodb

## Installation

```bash
npx degit https://github.com/TheSmartMonkey/create-serverless-simple-ts-service serverless-ts-service
```

Changes to be done

1. package.json config name

1. serverless.ts service name

1. Change the region in `serverless.ts` provider/region (current region: Paris)

## Getting started

1. Install serverless framework : [serverless framework Get Started](https://www.serverless.com/framework/docs/getting-started)

1. Setup your aws credentials : [aws config](https://www.serverless.com/framework/docs/providers/aws/guide/credentials)

Create a cloud formation stack on aws : `npm run deploy`

Remove a cloud formation stack on aws : `npm run undeploy`

## Manual test locally

In order to test the lambda functions locally, after you have deployed the stack a first times
for dependencies like dynamodb, run the following command:

- `npx sls invoke local -f hello --path src/functions/hello/mock.json`

Check the [sls invoke local command documentation](https://www.serverless.com/framework/docs/providers/aws/cli-reference/invoke-local/) for more information.

## To simulate remote locally

In serverless.ts put environment/OFFLINE to 'true'

Then run `npm run offline`

Your `sls invoke local` commands now target your offline stack