Backend programming with Node/Express/Mongo
Last modified: May 28 2019 - 1832hrs
Date: May 24 2019 - 1000-1200
Venue: Video Conference Room (VC), COM1 02-13
Finally, we reach the backend.
The topics covered are:
- REST / HTTP
- An abridged history of the modern interwebs.
- Node.js
- Express
- Websockets
- Mongo/mongoose.
When reading through the slides, please pay particular attention to
- what the goal of each technology is
- the strengths/weaknesses
- how each technology achieves its goals.
Of course, when implementing, your attention should be on:
- Unlimited pitfall works.
So you probably need to read the slides many times :D
Readings
Exercises
Assignment
Backend deep dive
Assignment
This assignment creates a single channel chatroom anyone can join.
The remainder of the features are up to you to implement.
A more detailed README.md is included in the template.
Task 1: Message basics
Note: start with a single chat room first.
- No need to over-complicate things.
- Simply redirect all users to the same chat room.
Implement the following:
GET /messages which …
POST /messages/new which…
Creates a new message.
Refreshing the client shall allow client messages to be updated.
Task 2: websocket based updates
Connect the client to the server such that all new messages will be sent to the client.
Task 3: Message model
Implement a Mongoose Model such that all new messages are saved in the database.
Load all messages from the database when the app starts.
Task 4: (Optional) Static server
Hosting the frontend from server. Implement vue history mode.
Task 5: (Challenge) file uploads
Using something like vue-dropzone, allow uploading files which become hostable urls.
Further practice.
User registration and login with passport.
Friends list / Multiple message threads.
Updating /deleting messages.
Solutions
Note: The solutions are not very good.
- Especially the database and interface design.
- This is mainly because the design for the product is 100% evolutionary.
- Just to prove that it can be done.
- Basically at this step, you should refactor it heavily.
- Consolidate the types, etc.