Snippets of Code is a website for saving, editing finding and sharing useful snippets of code.
Try the project live at https://snippetsofcode.herokuapp.com/
The JSON API that maintains the collection of snippets is based on the Team CRaKT's Week 7 project with a few small fixes and enhancements.
The new SPA / client code is all in the public folder.
Project build as a part of Founders and Coders FAC19.
Clone the repo git clone https://github.com/fac19/Week8-BFOP.git
CD into that folder cd Week8-BFOP
Run npm i
to install dependencies
Setup databases
ALTER USER your_user WITH SUPERUSER;
CREATE DATABASE local_production_database_name WITH OWNER your_user;
CREATE DATABASE localtest WITH OWNER your_user;
Create an .env file in the project's root folder
Run npm run setupdb
to initialize your local production database.
If you'd like more and proper full code examples you can import the file /db/examples.sql into your production database with your preffered db admin tool.
Run npm run dev
to run for development purposes
OR node server.js
to run server in production mode
Test can be run with npm run test
. You must have a database called localtest set up for the tests to run. No mocks here - we need to actually test our models!
There are five default users, their email addresses are.
Their passwords are all, unsurprisingly, 'password'.
The admin account is special. It can delete anyone's posts, other users can only delete their own.
Have fun and please PM us if you have an install problems!
P.S. They will almost certainly be database problems, so maybe double-check step 4.