Giter Club home page Giter Club logo

tobaccobot's Introduction

publication Archived Repository
The code of this repository was written to illustrate the blog post Retour d'expérience sur le développement d'un chatbot en Node.js avec serverless
This code is not intended to be used in production, and is not maintained.

#tobaccobot

##install Requirements:

  • With docker
    • Docker
    • docker-compose
  • without docker
    • node 4.3.2
    • Java Runtime Engine (JRE) version 6.x or newer
    • dynamoDB
    make dk_install

or without docker ()

    make install

Be careful: make install will not work properly if using node 5 or newer.

##development

make dk_run

will use docker to run

  • webpack-dev-server: webpack server to serve front-end static page (port 3001)
  • serverless-dev-server: serverless webpack plugin to serve lambda (port 3000)
  • dynamodb (port 8000)

To initialize smoker table do

make dk_setup_smoker_table

The lambda can be tested by sending request on port 3000

POST /subscribe

{
    "name": "john",
    "phone": "0123456789",
}

POST bot_conversation

{
    "phone": "0123456789",
    "text": "hello world"
}

Lambda can also be called with the serverless webpack command (emulate production environment)

docker-compose -f docker-compose.util.yml run --rm serverless webpack invoke -f lambda_name -p event.json

##test

make test

##Exploring dynamoDB dynamoDB come with a shell accessible on localhost:8000/shell. In this shell you can execute javascript to query dynamoDb. The shell use the api of an aws-sdk AWS.DynamoDB instance (no helper) Some useful script are in the DynamoDbScript folder, to use them simply copy paste in the shell or upload them.

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.