Giter Site home page Giter Site logo

deno-nasa's Introduction

Deno | The NASA Project

A full stack app written in Deno and Oak.

Deployed in Heroku with Buildpacks. Frontend: https://deno-nasa.herokuapp.com/index.html

  • Current libraries/frameworks available for Deno:

  • Oak Basics:

    • Current version: https://deno.land/x/[email protected]/mod.ts
    • Oak Documentation: https://doc.deno.land/https/deno.land/x/[email protected]/mod.ts
    • Example Context Response Headers (Middleware): contextHeaders
    • NOTE: Challenges Page found (although no new challenges out since 2019): https://adventofcode.com/2019/about
    • allowedMethods() allows other machines to know what routes our app supports and to get specific status codes back from the requests.
      app.use(api.allowedMethods());
      • With this implementation, if you try to use a method that our app doesn't include, it returns a 405 Method Not Allowed instead of a just a 404.
      • NOTE: The OPTIONS method, returns what methods are currently allowed by our app: optionsAllowed
    • Deno Error Handling can be set in the main/mod file as a middleware with the try-catch, and then log the errors within the EventTarget (https://developer.mozilla.org/en-US/docs/Web/API/EventTarget): app.addEventListener(). You can throw more specific errors with the Context: ctx.throw(501, "Sorry planets aren't available!"), although Oak won't show the message as body for statuses 50X.
    • The Context has the request.body() that parses the body appropriately (JSON).
  • Heroku Deployment

    • Create Procfile for Buildpacks deployments with Heroku & Deno: web: deno run --allow-net --allow-read --cached-only ./src/mod.ts --port=${PORT}

    • Buildpacks info: https://devcenter.heroku.com/articles/buildpacks

    • $ heroku login

    • $ heroku create --buildpack https://github.com/chibat/heroku-buildpack-deno.git deno-nasa

    • $ git push heroku main

    • You can restart the app:

      • From the platform (Restart all dynos):

        restartHerokuApp

      • From the console (individual dyno): $ heroku ps:restart web.1. Where web.x is the name and number of your dyno.

    • Logs: $ heroku logs --tail

deno-nasa's People

Contributors

manuel-valles 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.