Code Monkey home page Code Monkey logo

envoys-backend's Introduction

envoys-backend

Install

$ npm install serverless -g
$ npm install serverless-offline --save-dev
$ npm install ws
$ lein deps

REPL

Make sure you have something reasonable in your ~/.lein/profiles.clj:

{:repl {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]
        :plugins [[cider/cider-nrepl "0.17.0"]]}}
lein figwheel server

In a new prompt:

node "resources/local/js/localserver.js"

nREPL and Emacs

To start a repl:

lein repl

In Emacs, M-x cider-connect, then:

    user=> (use 'figwheel-sidecar.repl-api)
    ...
    user=> (figwheel-sidecar.repl-api/start-figwheel!)
    ...
    user=> (cljs-repl)

The prompt will hang. However, that's only because you need to start the server. Luckily for you, it was just built!

To start it:

node "resources/local/js/localserver.js"

You should then see in your repl that the prompt will change:

    cljs.user=>

Then interact with the repl normally.

Run locally (TODO)

I need to work out if it's possible to fix this, or provide an alternate path to local development.

$ sls offline start

With Serverless, you can invoke functions and pass stub data from a file. The docs are here.

Probably, you want to put some data in a directory and then invoke locally:

serverless invoke --function functionName --stage dev --region eu-west-1 --path data/data.json

The data directory is ignored by default.

Deploy

Make sure your AWS keys are available in your PATH, then:

$ serverless deploy

Redeploy Function

$ serverless deploy function -f index

Invoke

$ curl -X GET <url> -H 'Content-Type: application/json'

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.