Code Monkey home page Code Monkey logo

heritage-near-me's Introduction

Heritage Finder

Aka "OLD SKOOL FINDER" or "Old South Wales".

About

This project is designed to make local history and heritage more appealing. We're doing this by allowing users to swipe through interesting stories and people instead of places and things. This allows users to browse and let serendipity play a role in their interaction with heritage, making it accessible to more people.

Technical details

The code for this project can be found at https://github.com/CodeforAustralia/heritage-near-me

The project presents a single page HTML5 web app. The front end is powered by Elm, a typed, functional language which compiles to JavaScript. The back end is a Postgres database with a RESTful API created by Postgrest. The API and front end are pulled together by an Nginx server.

The front end code can be found in the prototype directory (for docs, start by reading App.elm and see this issue. The database schema can be found in backend/hnm-tables.sql and backend/hnm-views+functions.sql. The documentation for the REST API can be found here. The Nginx server config can be found in server/.

Setup

Install database, API server, and web server. Using brew on the command line, run:

brew install postgres postgis postgrest nginx

The output from the above command should say something about starting postgres and nginx, for example, you probably want to run this command next to make it so those two start when your computer does:

brew services start postgresql
brew services start nginx

Once PostgreSQL server is running, then import the required database:

cd backend
./dbinit.sh

(Need to wipe the database and restart? Run backend/dbdrop.sh.)

Start the API server

backend/apistart.sh

(If that works, you should see something like "Listening on port 3000". Keep that running as long as you want the API server to run.)

Start nginx

We use nginx so that requests to /api are rerouted to port 3000 where postgrest is serving the API (see how that works by looking at the nginx config file server/heritage-near-me).

Add that config file to nginx's config. For installs provided by homebrew on OSX, that means copying the file to (or linking to it from) the /usr/local/etc/nginx/servers/ directory.

ln -s `pwd`/server/heritage-near-me /usr/local/etc/nginx/servers/heritage-near-me

The root directive of our nginx config says where to find the prototype/ directory:

root /usr/local/var/nginx/hnm;

So set that up:

mkdir -p /usr/local/var/nginx
ln -s `pwd`/prototype /usr/local/var/nginx/hnm

Reload the nginx config:

nginx -s reload

nginx should now be running; open http://localhost:8088 in your web browser to confirm.

(Note, if that doesn't work you may need to make sure apache is stopped if you have that on your dev machine (sudo apachectl stop) and start the server: sudo nginx. If you need to stop it later, run sudo nginx -s stop).

Running PostgREST API as a service on Debian/Ubuntu

# prerequisite: postgrest binary from https://github.com/begriffs/postgrest/releases is installed as /usr/local/bin/postgrest, then:
cp server/postgrest-defaults /etc/defaults/postgrest
cp server/postgrest.init.d /etc/init.d/postgrest
sudo service postgrest start

Updating Elm files

npm install -g [email protected]
cd prototype && elm-package install && make app

heritage-near-me's People

Contributors

techieshark avatar kennib avatar jessemoreburritos avatar more-like-a-puma 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.