Neighbour.ly: Server
Overview
This is the back-end of Neighbour.ly, a communications app produced as part of our final two-week project of Makers Academy.
To see the ReactJS front-end, click here.
Neighbour.ly was produced as part of a wider challenge to learn how to use Go without prior knowledge. To see a record of our learning process and how we came to build Neighbour.ly, click here
Instructions
Go must be installed and your workspace configured to use this repo. For instructions on this, click here.
Install & run locally
$ brew install gorethinkdb
$ brew services start rethinkdb
$ go get github.com/ainsleybc/neighbourly
$ cd src/github.com/ainsleybc/neighbourly
$ go get ./...
$ go run db/dbSetup/dbSetup.go
$ go build
$ ./neighbourly
With the server running, you can then manually simulate messages sent from the front-end with JavaScript, using the console in your web browser or a service like JSBin.
For example:
var ws = new WebSocket("ws://localhost:4000")
ws.send('{"name": "feed add","data": {"address":"Makers Academy"}')
Test
$ go test -v ./...
Technologies used
Go
Main server-side language
RethinkDB
Database
External packages
- GoRethink: RethinkDB Driver for Go
- wstest: Client for testing WebSocket connections in Go
- Gorilla websocket: A Websocket implementation for Go
- Map Structure: A Go library for decoding map values into structs
- Bcrypt: Adaptive hasing algorithm for passwords
File Manifest
|-- neighbourly
|-- README.md
|-- integration.md
|-- main.go
|-- app
| |-- client.go
| |-- handlers.go
| |-- messages.go
| |-- router.go
|-- test
|-- LoginUser_test.go
|-- addFeed_test.go
|-- addPost_test.go
|-- signUpUser_test.go
|-- subscribeFeed_test.go
|-- subscribePost_test.go
|-- rethinkdb_data
|-- log_file
|-- metadata