https://github.com/chadhietala/hn-api-server
https://github.com/chadhietala/hn-api-server
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/chadhietala/hn-api-server
- Owner: chadhietala
- Created: 2017-05-04T19:27:58.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-04T19:28:27.000Z (about 8 years ago)
- Last Synced: 2025-02-10T08:23:09.152Z (4 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Hackernews API
This is a more generalized extraction of the Hackernews Preact app for others to use.
## Basic Usage
```
const Server = require('hackernews-api');
const server = new Server('preact-hn');server.listen();
```## Configurable Usage
```
const Server = require('hackernews-api');class MyServer extends Server {
defaultRoute() {
return function(req, res, next) {
res.write(`
Default Route
Hello World
`)
}
}addMiddleware(server, logger) {
logger.info('adding some middleware');
server.use(myCustomMiddleWare());
}
}const server = new MyServer('my-server');
server.listen(4200);
```