Skip to content

Backend for an app that lets you put messages on a map and get messages near you

Notifications You must be signed in to change notification settings

UW-Side-Project-Club/PointerServer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pointer Server

Backend for an app that lets you put messages on a map and get messages near you

Team members

  • 🐶
  • 🐱
  • 🐹
  • 🐰 Luana @l398chen
  • 🐼
  • 🐵 JP @junpark97

Running

For setup instructions, go to SETUP

In a new Terminal/Command Prompt,

Step 1: Get to the project folder

On Mac

cd ~/Documents/GitHub/PointerServer

On Windows

cd Documents\GitHub\PointerServer

Step 2: Start the server

On Mac

. venv/bin/activate
export FLASK_APP="server.py"
export FLASK_DEBUG=1
flask run

On Windows

venv\Scripts\activate
set FLASK_APP=server.py
set FLASK_DEBUG=1
flask run

Step 3: Check that the server is running

In another terminal, enter

curl localhost:5000/ping

You should see a Pong!

Testing the APIs

To get messages from the server, send a GET request to /messages with the lat and lon as query parameters:

curl localhost:5000/messages?lat=123&lon=456

To create a new message, send a POST request to /messages with a JSON body with lat, lon, and message specified:

curl localhost:5000/messages -X POST -H "Content-Type: application/json" -d '{"lat": 123, "lon": 456, "message": "My message"}'

You can also use Postman instead to get a pretty UI :)

Project files

PointerServer/   (project folder)
|
├── server.py    (Flask server)
├── database.py  (Database where we get the messages)
└── point.py     (Representation of a message)

Setting up SQLite and creating the the database

Install SQLite3: SQLite3

To create the databse or to refresh it:

Step 1: open your command prompt and go to the PointerServer directory

cd Documents\GitHub\PointerServer

Step 2: call SQLite3 and create the database by inputting the following code:

On Windows

sqlite3 database.db < schema.sql

About

Backend for an app that lets you put messages on a map and get messages near you

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%