Git Product home page Git Product logo

temps's Introduction


Logo

Temps

A serverless lambda runner, inspired by zeit now.


What can Temps do?

  • Temps can automatically hot swap your functions to an updated version without any dramas. This is achieved through GitHub webhooks.
  • Temps auto-scales your lambda function, whenever it detects a large amount of load in the event loop it creates a new thread to spread the load on.
  • Lightning fast, responds in under 5ms for a hello world async function!

Setting up your function

Programmatic setup

Temps is a breeze to setup, it's so easy it only needs an example:

// An optional function (optionally async) that runs before the server listens is executed.
// If the argument is present, the HTTP server will be passed to init for your usage.
exports.init = async ([server]) => { };

// Also works with HTTPS!
exports.credentials = {
  key,
  cert,
};

// A required (optionally async) handler (works with exports.default as well).
module.exports = async (req, res) => {
  // If this is an async function and you return either a string or buffer here
  // Temps will send the returned data! Async functions can still be used without this behavior.
  // You can run whatever you want in here: express, koa etc.
};

Make sure to use the main field in your package.json to point to an entry point file that matches the signature of the example above.

Compiling your code

Temps compiles your code by running the lambdaBuild script if present in your package.json. Please ensure that the entry point specified in the main field of your lambda's package.json points to the compiled entry point.

Configuring Temps

Repositories

To configure Temps to work with private repositories, setup a GitHub access token with the repos scope checked. Check out .env.example to see how to configure your repository. Temps works with GitHub webhooks with plans to support more platforms in future. To set it up, generate a secret for example: crypto.randomBytes(32).toString("base64") and set it to the env variable named SECRET. Then configure a push webhook on GitHub that uses that same secret and pushes to the following endpoint: example.com/.well-known/__lambda/update.

Software configuration

Refer to .env.example... it's pretty self-explanatory.

temps's People

Contributors

zorbyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.