https://github.com/hashnuke/prick
Prick.js lightweight web framework for node,js. Apologies for the bad name. I named it without knowing the other meaning of `Prick`
https://github.com/hashnuke/prick
Last synced: 12 months ago
JSON representation
Prick.js lightweight web framework for node,js. Apologies for the bad name. I named it without knowing the other meaning of `Prick`
- Host: GitHub
- URL: https://github.com/hashnuke/prick
- Owner: HashNuke
- Created: 2010-09-17T17:28:51.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-09-18T16:08:01.000Z (over 15 years ago)
- Last Synced: 2025-02-05T21:58:41.569Z (about 1 year ago)
- Language: JavaScript
- Homepage: http://github.com/HashNuke/prick
- Size: 434 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Prick.js
=========
### A simple web framework for Node.js
There's example.js for you to checkout and the there code is documented.
* import prick
var prick = require('prick');
* create a new prick
var app = new prick(); // skipping the new keyword is ok too
* Start pricking urls
app.forPath("/xyz", function(request, response){
response.writeHead(200, {"Content-Type":"text/html"})
response.write("
hello world
");
response.end();
});
* Incase of a regex url pass a regex object and a match is passed to your callback
app.forPath("/xyz", function(request, response, match){
response.writeHead(200, {"Content-Type":"text/html"})
response.write("the match is "+ match);
response.end();
});
404s are handled based on unfinished responses, so if you leave a request unended... i'll threaten you with a 404 :)
Right now there's no default headers. So this damn thing sounds lengthy. I'll fix this soon.
## TODO
* helpers to set headers and status code
* Static file handlers
* WebSocket support (via Faye)
* Session and cookie support
* Dependency management
Until then take a look at example.js for some goodness :)
### Happy message
I'm happy coz I can say...
> "dude, I wrote a web framework".
Ok seriously, I wrote this because I wanted to learn how frameworks worked and I needed a nice little framework to handle static files too (easily). Haven't reached that milestone, but soon will.