GithubHelp home page GithubHelp logo

turbo-octo-waddle's Introduction

Serverless - AWS Node.js Typescript

This project has been generated using the aws-nodejs-typescript template from the Serverless framework.

Installation instructions

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, run nvm use to ensure you're using the same Node version in local and in your lambda's runtime.

Using NPM

Installation:

  • Run npm i to install the project dependencies
  • Run npm run install-db to install the local DynamoDb once. A JRE is needed.

Running locally:

  • Run npm run dev to start a local dev server at port 8080

Known issues

The request validation doesn't work when run locally, but it is working fine when deployed. This is a known issue within in the serverless-offline package. If this would be a real project, I would try to switch to localstack. Maybe they do have a better AWS API Gateway emulation.

Testing

  • Run npm run dev (needed for local DynamoDb database)
  • Run npm run test to run all tests

Local CURL usage

Create News Article:

curl --location --request POST 'http://localhost:8080/dev/news-articles' \
--header 'Content-Type: application/json' \
--data-raw '{
    "title": "Man on the moon!",
    "text": "Astronauts land on plain, collects rocks, ..."
}'

Get News Article:

curl --location --request GET 'http://localhost:8080/dev/news-articles/b5771375-f9f8-4935-98c2-97ec913ff836'

Update News Article:

curl --location --request PUT 'http://localhost:8080/dev/news-articles/b5771375-f9f8-4935-98c2-97ec913ff836' \
--header 'Content-Type: application/json' \
--data-raw '{
    "title": "Russia puts man in space",
    "text": "Congrats by Kenedy, ..."
}'

Get All Articles:

curl --location --request GET 'http://localhost:8080/dev/news-articles/all'

turbo-octo-waddle's People

Contributors

pixelport avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.