Let's sell quotable fridge magnets!
reference site: www.wisefridge.com
API Routes (Back End)
- /magnets (/:id)
- /orders (/:id)
- /speakers (/:id)
- /users (/:id)
React Routes (Front End)
- Models are capitalized
- Join tables are alphabetical and pluralized based on two tables being joined i.e. MagnetsOrders
- FS Config with ESLint (with semicolons)
- Each Model has its own file
- Each Router has its own file
- Container Components have their own folder ('containers')
- Components have their own folder ('components')
I'm a happy little skeleton. You can clone me to use as a starter on your projects! I have React, Redux, Sequelize, and Express all just rattling around in here ready to go.
I need node >= 6.7.0
If you don't have it, I'll complain and tell you how to install it.
1. Make me into something!
We recommend that you clone, not fork, this repo – unless your intention is to develop Bones proper instead of using Bones as the starting point for your own application.
Start by doing either of the following:
- Create a GitHub repo and clone it, or
git initin an empty directory on your machine.
After you have a repo on your machine:
git remote add bones https://github.com/FullstackAcademy/bones.git git fetch bones git merge bones/master
And then you'll have me! If I change – which I probably will – you can get the most recent version by doing this again:
git fetch bones git merge bones/master
2. I need a name.
I don't have a name. I think I used to have one, but it turned to dust right along with my heart and liver and pituitary gland and all that stuff.
Anyway, I'll need one. Give me a name in
3. Start my dusty heart
Short and sweet:
npm install npm run dev
dev script sets
NODE_ENV to "development", runs the build script in watch mode, and
starts the server with
nodemon. Build vs server logs are separated by a prefix. If you prefer
to run the server and build processes separately, you can instead do:
npm run start-dev
npm run build-dev
In two separate terminals. The vanilla
npm start is for production — you won't use it in development!
/app has the React/Redux setup.
main.jsx is the entry point.
/db has the Sequelize models and database setup. It'll create the database for you if it doesn't exist,
assuming you're using postgres.
/server has the Express server and routes.
start.js is the entry point.
/bin has scripts. (Right now it has one script that creates a useful symlink.)
.jsx files, unless
require makes for cleaner code.
I use two spaces, no semi-colons, and trailing commas where possible. I'll have a linter someday soon.
Quick Heroku deployment
- Set up the Heroku command line tools and install Yarn if you haven't already (
npm install -g yarn)
- Add a git remote for heroku:
If you're creating a new app...
heroku create your-app-nameif you have a name in mind.
heroku addons:create heroku-postgresql:hobby-devto add postgres
npm run deploy-heroku. This will create a new branch and compile and commit your frontend JS to it, then push that branch to Heroku.
heroku run npm run seedto seed the database
If you already have a Heroku app...
heroku git:remote your-app-nameYou'll need to be a collaborator on the app.
- To deploy:
npm run deploy-heroku
- To re-seed:
heroku run npm run seed