--- _db_id: 282 available_flavours: - javascript content_type: project from_repo: projects/nodejs/file-io prerequisites: hard: - projects/sql - workshops/node-and-sql/ - projects/nodejs/file-io soft: [] ready: true story_points: 5 submission_type: continue_repo tags: - node - sql title: Node & SQL assignment --- You are required to create a back-end service that will help capture basic information about prospective students who come to inquire here at Umuzi. ## database setup 1. Set up a postgresql database on your computer. Please use Docker to do this. You can find more information here: {{% contentlink path="topics/intro-to-docker" %}} 2. Create a table inside the database and name it Visiters. 3. The table must contain the following fields : - id: This should be automatically generated by SQL - visitor name - visitor's age - date of visit - time of visit - name of the person who assisted the visitor - comments ## Helloworld Before you dive into anything too intense, let's make sure that you can get node to connect to your database. Can you get this Node script to run: {{% code_snippet "helloworld.js" %}} ## Functionality Create a single index script with the following functions: - `addNewVisitor`. This should save the Visitor into the database - list all visitors. This should return an array of all the visitor names and ids - delete a visitor - update a visitor - view one visitor: given a visitor's id, return all information about that visitor - delete all visitors ## NOTE You will be expected to properly test your code. You can use whatever testing framework you want. If you use something that isn't taught at Umuzi please justify your choice (if you found something cool we might incorporate it into the syllabus) ## Resources - https://www.guru99.com/introduction-to-database-sql.html - https://www.w3schools.com/sql/sql_intro.asp