GithubHelp home page GithubHelp logo

tako's Introduction

/*   Pratītyasamutpāda   */
/* Dependent Origination */

const a = (_this, that) => {
  if (_this) that()
}
const b = (that) => {
  const _this = false
  // vm knows this will never be called, this code can be dropped
  // and only ever appears in this textual form
  if (_this) that()
}
const c = (_this) => {
  const that = false
  // vm knows this will never be called, this code can be dropped
  // and only ever appears in this textual form
  if (that && _this) return _this
}

tako's People

Contributors

adamghill avatar alexindigo avatar isaacs avatar maxogden avatar mikeal avatar mmalecki avatar saambarati avatar shuhblam avatar soldair avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tako's Issues

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

.DS_Store in the templates folder causes stupid error

/Users/maxogden/src/bro/node_modules/tako/handlebars.js:288
            throw new Error(str);
                  ^
Error: Lexical error on line 1. Unrecognized text.

after debugging and figuring out handlebars was trying to evaluate a .DS_Store file i deleted it and the server started up normally

middleware: Replace .onWrite method with the ability to return a different writable stream

So, right now, middleware can do this:

middleware.on("request", function (req, res) {
  res.onWrite = function (chunk) {
    // do something, and return a different chunk synchronously
  }
})

however, there's no way to:

  1. Know when the response is ended
  2. Do something asynchronously

Really, what you want to do is hijack the actual request/response with a filter of some sort.

For example, a gzip middleware might conditionally want to attach a decoding filter onto the request, and an encoding filter onto the response.

Consider this:

gzipMiddleware.on("request", function (req, res) {
  // attach a filter in front of the readable request stream.
  // Methods proxied: pipe, pause, resume
  // .on() attaches listeners to filter instead for: data, end, close
  if (requestCompressed(req)) req.filter = zlib.Unzip()

  // attach a filter in front of the writable response stream.
  // Methods proxied: write, end
  // .on() attaches listeners to filter instead for: pause, resume
  if (responseCanBeCompressed(req)) res.filter = zlib.Gzip()
})

Feedback

tldr; really liked what the tako example looked like, tried it out, couldn't figure out a good way to serve a 404 page, couldn't figure out how to have static files in sub-folders get served.


Hey Mikeal,
Some things that happened when I tried to use tako for my static site:

PUBLIC = path.join(__dirname, 'public')
app.route('/').files(PUBLIC)
  • sub-folders of /public are not correctly found & served by filed
  • if the file is not found, there is not a good way to serve a 404 page, e.g. public/404.html (I took a stab at writing this, but it doesn't feel very elegant)
app.notfound.html = path.join(PUBLIC, '404.html');

And in app.notfound:

@@ -437,10 +437,16 @@ Application.prototype.notfound = function (req, resp) {
   resp.setHeader('content-type', cc)
   if (cc === 'text/html') {
     body = '<html><body>Not Found</body></html>'
+    if (this.notfound.html) return filed(this.notfound.html).pipe(resp)
   } else if (cc === 'application/json') {
     body = JSON.stringify({status:404, reason:'not found', message:'not found'})
   } else {
     body = 'Not Found'
+    if (this.notfound.html) {
+      resp.setHeader('content-type', 'text/html')
+      console.log('fugg', this.notfound.html, resp.getHeader('content-type'))
+      return filed(this.notfound.html).pipe(resp);
+    }
   }
   resp.end(body)
 }

resp.redirect method

I'm totally enjoying work with tako. I found that you didn't implement the redirect method in the resp.

For the moment I'm doing this:

resp.redirect =  function(url, status) {
  resp.statusCode = 302
  resp.setHeader('Location', url)
  resp.end()
}

And it's working, but I feel like there is a lot of more options to implement in this method (not an expert), Also I didn't found a bodyParser for inconming request. That will be handy.
I'm really looking forward for it, for this implementation.
Cheers.

session token cookies

Some basic session handling would be good. Not anything like Express's in-memory sessions, or some kind of fancy pants pluggable session, but just the most basic possible token management.

  1. app.sessionKey = value This would enable the behavior. The configuration could be gotten from wherever, or even just set randomly.
  2. If a request comes in with a cookie named app.sessionKey, then set request.session = cookies[app.sessionKey]
  3. If a request does not have a cookie named app.sessionKey, then set a response.headers['set-cookie'] so that it'll be set to a random string (like require("crypto").randomBytes(30).toString("base64") or something).

Then, it's up to the app to know what to do with this token, what it means, etc. It could be a key to some in-memory store, or a redis doohickey, or the name of another cookie that they'll set the actual data in, etc.

make templates dir accept a regex

t.templates.directory(path.resolve(__dirname, '..', 'templates')) loads every file in the ./templates folder but I'd like to say:
t.templates.directory(path.resolve(__dirname, '..', 'attachments'), /*.mustache/) or whatever so I can use the same folder for static assets + templates

maple 0.3.0 breaks .files

I had a simple static fileserver, just like in the example:

tako = require('tako');
app = tako();
app.route('*').files(require('path').join(__dirname, 'public'));
app.httpServer.listen(9999);

The query for something...

  curl localhost:9999/something.txt

... will now be redirected to...

  ./public/something.txt/

... and not obviously not found there.

I changed the mapleTree version from * to 0.2.x to fix this.

npm version > git version

The current tako version being pulled via npm doesn't match the github repo. Version is "0.2.5" as opposed to "0.2.4" and socket.io is being installed by default again.

app.route("...").form() method

For GET requests, it should be the same as route.html(). For PUTs and POSTs, however, it also accepts application/x-www-url-encoded (in which case it'll be buffered and parsed), or multipart/form-data, in which case it will run it through formidable or something.

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.