Coder Social home page Coder Social logo

sweb1433 / serverless-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 16 KB

serverless-api using node

JavaScript 100.00%
serverless-framework serverless-offline serverless-deployments serverless-functions serverless-examples api crud-api crud-functionality node-js mongodb

serverless-api's Introduction

rest-api-serverless

N|Solid

CRUD api using nodejs, serverless, lambda functions and mongo cluster as Database.

-Step 1. Creating a directory

-run : sls create -t aws-nodejs -p rest-api && cd rest-api

  -This command will scaffold out all the necessary files and code to create our Lambda functions and API Gateway events. It will do this in the path we gave it with the -p flag. Meaning it will create a directory named rest-api.

-step 2. Installing modules

-run : npm install
-This will download all your dependencies.

Step 3. Creating a database on MongoDB Atlas

  • click on below link

  • -https://www.mongodb.com/cloud/atlas?jmp=nav
    
  • and setup your cluster and credentials to connect to your database. also download Studio 3T to connect to the database and see the tables. also create a variable.env file in the root directory and inside that set DB=(your connection link with password)

    -https://studio3t.com/download/
    

    -click above link to download Mongo client.

Step 4. Testing with postman.

-run: sls offline start --skipCacheInvalidation

Step 5. deploy on AWS

-run : sls deploy
  • note: uncomment 'Note.create(event.body)' and comment 'Note.create(JSON.parse(event.body))' in 'handler.js' file when deploying on serverless.

Step 6. To remove functions

-run : sls remove sreverless-api

serverless-api's People

Contributors

sweb1433 avatar

Stargazers

 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.