This project has been generated using the aws-nodejs-typescript
template from the Serverless framework.
For detailed instructions, please refer to the documentation.
Depending on your preferred package manager, follow the instructions below to deploy your project.
Requirements: NodeJS
lts/fermium (v.14.15.0)
. If you're using nvm, runnvm use
to ensure you're using the same Node version in local and in your lambda's runtime.
- Run
npm i
oryarn
to install the project dependencies
In order to test the project locally, run the following command:
npm run generate
the script generate the prisma dependencies necessary in the project to connection and queries to the DBnpm run off
this script run the project locally using the plugin "serverless-offline"
The first step is deploy the backend project into aws account. The properly way to happen when the code is pushed into the repository backend. Currently the dev branch has the action to deploy the code when it is updated.
The second step is take the url given where the endpoints are hosted and do the http request.
curl --location --request POST 'https://...amazonaws.com/dev/my-endpoint' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Frederic"
}'
The project code base is mainly located within the src
folder. This folder is divided in:
common
- containing all the business logic, connections with externals services and other configurations.functions
- containing code base and configuration for your lambda functionslibs
- containing shared code base between your lambdas
- json-schema-to-ts - uses JSON-Schema definitions used by API Gateway for HTTP request validation to statically generate TypeScript types in your lambda's handler code base
- middy - middleware engine for Node.Js lambda. This template uses http-json-body-parser to convert API Gateway
event.body
property, originally passed as a stringified JSON, to its corresponding parsed object - @serverless/typescript - provides up-to-date TypeScript definitions for your
serverless.ts
service file - serverless-openapi-documenter - allowed create a document openApi (json) in order to document all the endpoints created in the backend project. In order to get the file updated make sure execute
npm run doc
.