Giter VIP home page Giter VIP logo

node-pi-hole-api's Introduction

node-pi-hole-api

Build Status Coverage Status JavaScript Style Guide

Dependencies

Pi-hole An updated API server written with Node.JS

Install

  • Install Node 8+

  • curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

  • nvm install 8

  • npm install --production

    • or use yarn becuase it is much faster
  • npm start

  • A local server will be started on port 3000

    • curl http://localhost:3000/admin/api.php?summary to get summary

Integrate with existing pi-hole admin panel

Follow this guide to setup nginx server and use this nginx config in order to proxy requests to /admin/api.php to our node server

server {
  listen 80 default_server;
  listen [::]:80 default_server;
  root /var/www/html;
  index index.html index.htm index.php;
  server_name _;
  autoindex off;
  location / {
    expires max;
    return 204 'pixel';
  }
  location /admin {
    root   /var/www/html;
    index index.php;
    auth_basic "Restricted"; #For Basic Auth
    auth_basic_user_file /etc/nginx/.htpasswd;  #For Basic Auth
  }
    location /api {
    proxy_pass http://localhost:3000;
  }

  location = /admin/api.php {
    proxy_pass http://localhost:3000;
  }

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
  }
}

Why

I wanted to take a crack at porting the pi-hole PHP server side code to Node JS. Major credit goes to: xlc/pi-hole-api. This is an updated version of that.

Development Tips

If you have the pihole-FTL service running on your Raspberry-PI, you can forward that port via SSH:

ssh -L 4711:localhost:4711 user@ssh-host

node-pi-hole-api's People

Contributors

geoffdutton avatar xlc avatar

Watchers

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