« first day (260 days earlier)      last day (2504 days later) » 

3:14 AM
anyone know in express how I can make all routes to default to search for index.html and if it exists serve it else provide 404?
 
3:36 AM
do you mean for instance /rooms/thing => /rooms/index.html ?
 
File based routing is rage
 
If that's what he wants. Maybe he's looking to do a form of lazy static loading?
 
I just think its a dirty hack
and a design decision thats epic fail and needs to be fixed
 
3:57 AM
i was thinking of say you type in localhost/foo and it would attempt to find localhost/foo/index.html if available without having to define a route for each
 
Why :\
Why would you ever do that.
 
it's what most other web servers do?
I just want to dump static web sites in a folder and serve them up
 
Use a public file router
app.use(express.static(path.join(__dirname, "public")));
Then dump all your static web pages (html) in the public folder
 
right, but I dont want to have to type in index.html in the url
 
...
Then write routes
Or name your files properly
like public/rooms.html
or Write your own .static router that assumes text/html by default and accepts any file name so you can do public/rooms
 
4:07 AM
sounds great, can you perhaps direct me to any docs on where to start with that?
 
4:18 AM
hmm.... nm, well I searched the source and found the static.js module in connect and it has support for index.html built in... it's just not working for some reason... I'll dig further in the source... thanks
 
4:35 AM
Your right, it should work
 
5:04 AM
aha, found the problem. it's assuming I'm on linux :) windows uses a backslash, connect's static router is just testing for forward...
 
I see
make a pull request
and change the code to use path
 
just looked, there is already a pull request on connect github.com/senchalabs/connect/pull/430
 
@Warspawn what windows are you using?
 
7 64-bit
 
Oh ugh windows y u suck
 
5:13 AM
I like playing Skyrim
 
That problem should be solved with path.join
not manual hacks
 
problem is the test
// index.html support
132
- if ('/' == path[path.length - 1]) path += 'index.html';
is what was originally in there
how would join solve that?
 
Dont know it depends
do you want `website/bar\` to work?
or do you want website/bar/ to work?
Do you want website/bar to work?
The problem is basically that / == path[path.length -1] sucks
 
the path in that context is pointing to the file system location not the url
 
oh really?
In that case, ehm. I dont know how you would do it to be honest :\
 
5:21 AM
yeah, it's like c:\users\blah\public\foo\
 
in a non hackish way
what you really want is an isDirectory check
 
it does that later on, it checks isDirectory and then sticks '/' on the URL and 301, second time round it tests the end and sticks index.html on it
maybe I could / should just do it in the 301
hmmm will try
yes, that would work also, but I see why they didn't do that, that way it writes the url, so you can't have your url be localhost/foo it'll get redirected to localhost/foo/index.html
which for my purposes isn't a huge deal, I only didn't want to have to type index.html
but I could see for some having the clean url is better
 
5:53 AM
ok, found a more "non-hackish" way
if(path.existsSync(normalize(join(filePath, "/index.html")))) {
filePath = normalize(join(filePath, "/index.html"));
};
 
6:09 AM
...
you know sync is bad right?
 
the async version I'd have to wrap the rest of the method in a callback
 
yep
but you should never use the sync version
and rather then using exist
favor stat and .isDirectory
 
but even if I were to wrap the rest of the method in a callback wouldn't it still effectively be waiting for it to finish? and why bother creating existsSync if it should never be used? surely there are times when sync makes sense
 
6:27 AM
ok, well regardless of that, as it turns out, connect itself is updated and working, it's express that has an outdated version of connect
they still have this hack in there, if ('/' == path[path.length - 1]) path += 'index.html';
the next call: path = normalize(join(root, path)); used to happen before the test, now it's after, so it seems normalizing and joining the root caused the issue
 
 
9 hours later…
3:08 PM
...
There are times to use Sync
but that isnt one of them
@Warspawn do you realise that using Sync methods in a request handler is a massive bottleneck that throttles your event loop?
 
 
3 hours later…
Tom
5:55 PM
@Raynos hey
 
6:12 PM
@Tom hey
 
6:26 PM
I cannot possibly express how disappointed I am that Node does not have proper MS SQL support yet.
 
you just made raynos mad now
incoming rage
 
:) Been a while since I joined this room, didn't even bother saying hi.. just went right for rage inducement.
At work I've been building Node.JS back-end services & proxies.. but I want to build an intranet application that already has an existing MS SQL database.
How is it possible that ODBC on windows has not been tackled?
 
it's quite strange though since joyent and MS have some agreements and such things
I saw even module for oracle
so I guess ms sql would follow
 
7:04 PM
My other option is to make a C# console app that takes a query on the command line and outputs a JSON result-set.. and then shell execute it. This I will prototype now.
 
@Fosco it kind of does
use the tedious driver : github.com/pekim/tedious
 
Yeah I was looking at tedious, but it's not really production ready yet... just one guys work-in-progress TDS implementation.
 
Yeah
that's how shit works
You want a driver, contribute
There are a shit ton of windows dev that want the driver
but none can be assed to write them
Where as all the open source guys working on node use linux and dont have any any need for a sql driver
 
:)
 
The type of people that write awesome open source modules dont need the driver
the type of people that need the driver don't write awesome open source modules
Easy problem to solve. Write awesome open source modules.
@Fosco if you dont like it write a little server that accepts strings, runs the query on sql server and returns raw data
 
7:16 PM
Open source is not my concern... I work at a private business.
 
Oh you already said that :D
c# console app
@Fosco but open source :( if your going to write a library it should be open source
 
I don't think my clients would like me open-sourcing the projects they pay $$$/hour for.
 
why not :\
They get free community activity
its not open sourcing the projects
your open sourcing the tools you use to build their projects
I dont recommend open sourcing their application, that's not cool.
But any tools you construct along the way are cool to be open source
 
I may consider open sourcing some stuff, but I'd really have to re-write things specifically for that purpose.
 
You generally have to
 
 
1 hour later…
8:38 PM
Alright, got a quick and dirty C# sql processor working for Node.. returns JSON result sets.
 
oh god why are those infoq presentations so loooooooooong
 
8:57 PM
posted on December 09, 2011

In this episode Pedro shows you the power and simplicity of Konphyg to parse and merge configuration files for different environments.

 
 
1 hour later…
9:59 PM
@Tom pong
 
10:49 PM
Chuck Norris wrote Hello World once... it was called Unix.
 
11:18 PM
Anybody heard of dotcloud?
 

« first day (260 days earlier)      last day (2504 days later) »