https://codeforuv-ruralnetv2.herokuapp.com/
The main goals of this project are to develop a web app that measures a user's internet speed and allows us to visualize this speed against the reported speed of their Internet Service Provider (ISP). At the same time we would like to survey users about how they typically use their internet and how satisfied they are with their current service.
This information would allow municipalities to apply for grants and funding to improve their local internet infrastructure and/or hold ISPs accountable for providing subpar service.
To run the app locally you'll first need to make sure you have nodejs installed on your machine. Then:
- Clone this repo:
git clone https://github.com/codeforUV/ruralnetv2.git
- Install dependencies:
npm install
(run from inside the project folder) - Configure the development environment mongo connection, by renaming
.env-example
to.env.local
and paste in the mongodb connection string forVITE_MONGODB_URI
(ask @ejolly or @colbyhemond) - In the same file paste an api key string for
MAPQUEST_KEY
(ask @ejolly or @colbyhemond) npm run dev
(launch the server)- Open
http://localhost:3000
in your web browser to see the app
src/hooks.js
- Server-side functions that run on each request made. We currently use these to establish our initial MongoDB database connection and manage cookies. See SvelteKit hooks for more
src/lib/components/
- contains Svelte components reused throughout the app, e.g.
Footer.svelte
- contains Svelte components reused throughout the app, e.g.
src/lib/models.js
- contains the database schema and models
src/routes/
- each folder or file here will become a page in the app
- If using single files just name the file for the page you want, e.g.
mypage.svelte
will becomeruralnetv2.herokuapp.com/mypage
- If using a folder make sure to include an
index.svelte
file in that folder, e.g.about/index.svelte
will becomeruralnetv2.herokuapp.com/about
- Within any folder in
src/routes
add anindex.js
file that exports javascript functions corresponding to http methods you want functionality for (e.g.export async function get()
->GET
request to that route) - Whatever is returned from the
body
of these functions will be available as variables inside the correspondingindex.svelte
file within that same folder and can be accessed usingexport let variableName
- Additionally this
index.svelte
file can export a specialload()
function within ascript context='module'
tag in order to perform additional functionality when making aGET
request to the corresponding end-point (e.g. additional processing of the data returned from the server orfetch
from another resource)- If no additional functionality is needed, then the
load()
function can be omitted from theindex.svelte
file
- If no additional functionality is needed, then the
- See SvelteKit endpoints for more details