package.json commands cat and rm have been reconfigured for windows to use type n del for building and deleting DB, Mac users will need to change it back to those commands
- NodeJS
- follow the install instructions at https://nodejs.org/en/
- we recommend using the latest LTS version
- Sqlite3
- Windows users: follow instructions here https://www.sqlitetutorial.net/download-install-sqlite/
- Mac users: it comes preinstalled
- Linux users: use a package manager eg. apt install
To install all the node packages run npm install
from the project directory
A few aspects SQLite3 work a little differently to mySql but all of the key concepts are the same
Find the API documentation at: https://github.com/TryGhost/node-sqlite3/wiki/API
Find node SQLite tutorials at: https://www.sqlitetutorial.net/sqlite-nodejs/ This also a good resource to find examples and tutorials around SQLite queries
This template sets you off in the right direction for your coursework. To get started:
Run npm run build-db
to create the database (database.db)
Run npm run start
to start serving the web app (Access via http://localhost:3000)
You can also run:
npm run clean-db
to delete the database before rebuilding it for a fresh start
- Explore the file structure and code
- Read all the comments
- Try accessing each of the routes via the browser - make sure you understand what they do
- Try creating ejs pages for each of the routes that retrieve and display the data
- Try enhancing the
create-user-record
page so that you can set the text in the record - Try adding new routes and pages to let the user create their own records
- All database tables should created by modifying the db_schema.sql
- This allows us to review and recreate your database simply by running
npm run build-db
- Do NOT create or alter database tables through other means
Make a copy of this folder In your copy, delete the following files and folders: * node_modules * .git (the hidden folder with your git repository) * database.db (your database)
Make sure that your package.json file includes all of the dependencies for your project NB. you need to use the --save
tag each time you use npm to install a dependency
Run npm install
to install the necessary dependencies.
Run npm run clean-db
to clean db
Run npm run build-db
to build the database.
Run npm run build:css
to build the tailwind CSS. important
Run npm run start
to start the application. It will be accessible at http://localhost:3000.
Edit this section to include any settings that should be adjusted in configuration files and concise instructions for how to access the reader and author pages once the app is running.
NB. we will ONLY run npm install
, npm run build-db
, and npm run start
. We will NOT install additional packages to run your code and will NOT run additional build scripts. Be careful with any additional node dependencies that you use.
/
This is the root route, and it redirects to/reader
./reader
This is the front page which readers use to access the blog site./reader/:id
This is where the reader can read and interact with individual articles./author
This is where the Author can create, review and edit articles./author/new
This is where the author creates an individual article./author/edit/:id
This is where the author writes, amends, and publishes individual articles./author/settings
This is where the Author can change the blog title, subtitle, and author name.