GithubHelp home page GithubHelp logo

noscripter / hackernews-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from boxyco/hackernews-api

0.0 1.0 0.0 886 KB

A RESTful API for news.ycombinator.com written in Coffeescript for node.js

License: Apache License 2.0

CoffeeScript 100.00%

hackernews-api's Introduction

Hacker News API

RESTful http://news.ycombinator.com API written in Coffeescript for node.js, utilizing jQuery, JsDOM, and express.

API Url Examples

Retrieve Front Page News

URL: http://localhost:1337/news or http://localhost:1337/news/{nextId}
Method: GET
Returns: nextId: ID for next page of links
items: array of links {commentCount, id, points, postedAgo, postedBy, title, url}

Retrieve Jobs

URL: http://localhost:1337/jobs or http://localhost:1337/jobs/{nextId}
Method: GET
Returns: nextId: ID for next page of links
items: array of links {commentCount, id, points, postedAgo, postedBy, title, url}	

Retrieve Newest Posts

URL: http://localhost:1337/newest or http://localhost:1337/newest/{nextId}
Method: GET
Returns: nextId: ID for next page of links
items: array of links {commentCount, id, points, postedAgo, postedBy, title, url}	

Retrieve Ask HN Posts

URL: http://localhost:1337/ask or http://localhost:1337/ask/{nextId}
Method: GET
Returns: nextId: ID for next page of links
items: array of links {commentCount, id, points, postedAgo, postedBy, title, url}	

Retrieve Post Comments

URL: http://localhost:1337/discuss/{id}
Method: GET
Returns: array of comments {indent, comment, postedAgo, postedBy}

Retrieve a user's profile

URL: http://localhost:1337/profile/{username}
Method: GET
Returns: about, createdAgo, karma, username

Retrieve Posts Submitted By User

URL: http://localhost:1337/profile/{username}/submissions/{nextId}
Method: GET
Returns: nextId: ID for next page of links
items: array of links {commentCount, id, points, postedAgo, postedBy, title, url}

Retrieve Comment Threads for a user

URL: http://localhost:1337/profile/{username}/comments
Method: GET
Returns: array of comments {indent, comment, postedAgo, postedBy}

Developers

####Node.js dependencies

  • Our script depends on jsdom and express. To install, just run the following command while in the directory:
$ npm install

####Compiling Instructions

  • Compiling requires coffeescript, doesn't matter what flavor. If you are using npm:
$ npm install -g coffee-script
  • Compiling for production
$ coffee --compile hackernews-api.coffee
  • Or live compiling
$ coffee --watch --compile hackernews-api.coffee
  • Then run it!
$ nodejs hackernews-api.js -p1337

Author(s)

Eric Lewis

Copyright and license

Copyright 2012 boxyco, LLC.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

hackernews-api's People

Contributors

aaronontheweb avatar ericlewis 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.