Skip to content

Commit

Permalink
added default router
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoKandut committed Aug 12, 2018
1 parent 2006512 commit 46e7dc9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions defaultRouter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const express = require('express');
const scraper = require('./scraper');
const defaultRouter = express.Router();

const baseUrl = 'https://rule34.xxx/index.php?page=dapi&s=post&q=index'

defaultRouter.get('/', function (req, res) {
res.json({
message: "This is a wrapper for the rule34 api. For more info see /~https://github.com/KuroZen/r34-json-api#readme",
posts: process.env.HOST + "/posts",
comments: process.env.HOST + "/comments"
});
});

module.exports = defaultRouter;
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ process.env.PORT = process.env.PORT || 8080;
process.env.HOST = process.env.HOST || 'http://localhost:' + process.env.PORT;

// require routers
const defaultRouter = require('./defaultRouter');
const commentRouter = require('./commentRouter');
const postRouter = require('./postRouter');

// assign routers
app.use('/', defaultRouter);
app.use('/comments', commentRouter);
app.use('/posts', postRouter);

Expand Down

0 comments on commit 46e7dc9

Please sign in to comment.