- NodeJS
- NPM (comes installed with NodeJS)
- PostgreSQL
If you want to deploy you'll also need:
- A Heroku account
- The Heroku CLI
- Install dependencies with
npm install - Create a file in the folder of the project called '.env', with content
DEV_DATABASE_URL=postgres://postgres@localhost:5432/girlscode_library_app
You may change this to 'postgres://username:password@localhost:5432/girlscode_library_app' if using different username/password than default.
- Create the DB with
npx sequelize db:create - Run the migrations with
npx sequelize db:migrate
$ npm run dev
Open your browser and go to: http://localhost:3000/
Let's say you want to make a change/enhancement/extension to the app.
You only need do this once.
Create a new remote link, called upstream, that points to the original repository. This will allow you to keep up to date with ongoing changes that others have made. (You have to do this on the command line: GitHub desktop doesn't support this.)
$ git remote add upstream https://github.com/GirlsCodeMK/libraryapp-hackathon-js-starthere.git
Before you start work, ask around to make sure no-one else is working on that feature!
- Make sure your local copy of your repository is up-to-date by
fetching any updates andmergeing them into your local repository.
$ git checkout master
$ git fetch upstream
$ git merge --ff-only upstream/master
- Create and checkout a new branch for your feature. Call the branch anything you want, but you may want to include your name and/or the issue number (if you're addressing an open issue on the project).
$ git branch cool-feature
$ git checkout cool-feature
(You can do both of these steps as one with git checkout -b cool-feature)
-
Do some work on this feature. Make commits often, as is good Git practice.
-
Sooner or later (and preferably sooner), you'll want to
pushthese commits to your ownoriginrepository on Github. The first time you do this, you need to tell Git to create a new branch in your remoteoriginrepository on GitHub.
$ git push --set-upstream origin cool-feature
- As you continue to work, make more commits and push them.
$ git push origin cool-feature
Once you've finished your cool feature, it's time to get it accepted into the main project.
- Check that the main
masterhasn't changed while you've been working.
$ git checkout master
$ git fetch upstream
$ git merge --ff-only upstream/master
As you've not changed our local copy of master, there should be no conflicts here.
- Merge the newly-updated
masterinto your feature branch
% git checkout cool-feature
% git merge master
(If you're feeling confident about what you're doing, you can rebase your changes instead of mergeing them.)
-
Fix any conflicts between your changes and the updates in
master. Once you're done, commit the changes back to your feature branch. (Git is helpful here in guiding you through the process.) -
Push your changes back up to your repository
$ git push origin cool-feature
-
On the GitHub website, find the big green "New pull request" button to ask for your changes to be included into main repository.
-
That's all you need do: someone else will look at your changes and advise you on what happens next. Your changes could be accepted as-is, or the review could suggest some improvements to make to your feature.
As well as some comments in the code, you can also open the Paw or Postman API collections to view example requests.
-
Create Heroku app
$ heroku apps:create -
Add a PostgreSQL database
$ heroku addons:add heroku-postgresql -
Set a
SESSION_SECRETenvironment variable$ heroku config:set SESSION_SECRET=mysecret -
Do a deploy
$ git push heroku master -
Run the migrations (you'll need to do this if you add any more migrations too)
$ heroku run npx sequelize db:migrate
- Initial set up, communicating with PostgreSQL database.
- Create/Read/Update/Delete books
- Sign up
- Sign in (sorta)
- Deployment
- Authentication framework (persisting sessions, basic auth?)
- Sign out
- List loans
- Create loan
- HTML views for books, sign up, sign in
- HTML views for your loans, taking out a book
- Return book
- Commented throughout
- Update user
- Delete user
- Some kind of permissions system, right now anyone can create a book.
- Check a book isn't already on loan before loaninng it out (race condition)
- Layout; navbar etc.?
- Use a more production ready session store.
- Tests