London Underground Journey Planner
- 7 Devlogs
- 6 Total hours
Travel planning webapp with entirely custom-built HTTP server, templating engine and pathfinding algorithm!
Travel planning webapp with entirely custom-built HTTP server, templating engine and pathfinding algorithm!
I have deployed the new version of the app to the server and cleared Cloudflare caches so that the new feature should be fully functional on all browsers!
I’ve finished the recent journeys feature and improved the database code so that it handles multiple clients properly! I used some custom logic to decide how to tell the user the time since they took a journey, based on how long ago it was.
I’ve now (almost) fully implemented the first version of the recent journeys feature! The time you took the journey is still shown as a Unix timestamp - I just need to add some switch-case logic for choosing how to display the time in a human-friendly format! I had to implement a new API endpoint, /api/stationName, on the server so that I could get station names from the database but this is working now, and the client-side JavaScript reads from the locally stored database whenever the homepage loads, before grabbing the station names from the server and displaying everything in the table! The screenshot is the real app, not test data! I haven’t deployed it to the main server yet because I need to make the database handler a bit more robust to deal with the increased simultaneous requests, and I want to make the time element more user-friendly. Watch this space for more!
I’ve now fixed the logic for deleting old journeys, so a local IndexedDB stores the user’s five most recent journeys on their device, with the origin, destination and timestamp. Once the database table reaches five entries, the oldest one (based on the incrementing primary key) is automatically deleted so that we don’t clog up users’ storage space! Now I need to implement a backend lookup to find station names based on their IDs, so that I can implement the recent journeys UI component!
I’ve been working on the frontend of the app as previously most of the effort had been on the backend! First of all I am adding a ‘recent journeys’ feature which will let users easily access journeys they’ve previously searched for. So that I don’t have to implement a login system, and to increase user privacy, I am storing the recent journey data in IndexedDB on the client side, so I have had to start implementing the logic for that. So far, I have managed to store the journey data but now need to fix the logic for deleting old journeys and filling the recent journeys UI component. Below is a prototype (with dummy data) of the recent journeys UI, let me know what you think!
Based on rater feedback, it seems a bit tricky to use for people who aren’t familiar with London! The project uses Underground stations and not landmarks, so try typing a few letters to start searching… if you don’t know any, how about Liverpool Street or Paddington to get you started?
In this session I’ve been writing the README so that people who come to the GitHub repository have a better idea of how the project works and how all the code fits together, as well as how to compile it for themselves!
In this first session I have redesigned the file handling logic for my template HTML files and static assets! Previously I was using a standard Java file handler to open these and serve them to users over the TCP socket, but I have now used Java’s resource functionality so that I can bundle the templates and static files into an artefact for deployment to the server! I have also been working on configuring the server ready for deployment and have deployed my project on Hack Club Nest so that others can try out the system! Still lots of work to do on improving the database system and making the journey planning algorithm itself a bit more sensible, but I have improved search times by fixing the journey planning algorithm so that it functions as a full A* pathfinding algorithm. Note that before Stardance, I had already developed most of the code in the project and my aims are to improve the project and make it work better as an online service!