Template to get started on a PERN stack Single Page Application (PostgreSQL, Express, React.js, Node.js)
- PG-Promise
- To connect our PostgresSQL database
- Express.js
- framework used for our API server
- React.js
- Client side library for our view layer
- Webpack
- Application bundler used for our React client
- Dotenv
- Loads
ENVvariables from a.envfile
- Loads
- CSS Modules - Demo of CSS Modules with Webpack
Install Node Module with
$ npm install
Run Webpack build and tell webpack to continue to watch for changes
$ npm run watch
- The
watchscript is used for developmnet. It "watches" yoursrc/directory for any changes and rebuilds your React Client to
Open another terminal window and start your server
$ npm start
webpack.config.js- Our webpack configuration for bundlign our client application.babelrc- Babel configuration filescripts/- Contains scripts to be run at deployment (look into thepackage.jsonto see where each script should be used)
server.js- Express server entry pointroutes/- Empty directory to store all of your server's API routesmodels/- Empty directory to store all of your modelsdb/- Our database directory containing:db.js- This is the database connection module that will use our Postgres
ENVvariables stored in our.envfile
- This is the database connection module that will use our Postgres
schema.sql- Empty SQL file that can be used to setup and edityour applications relations
- You can run this file in your CLI using
psql -d <your_databaase> -f db/schema.sql
seeds.sql- Empty SQL file that can used to seed your database
- You can run this file in your CLI using
psql -d <your_databaase> -f db/seeds.sql
src/- Contains all of our React client's filesindex.js- The client application's entry point as defined in our webpack configcomponents/- Directory to store all of our React componentsApp.jsx- Our React applicaiton container componentApp.css- Basic styling for theHello Worldapplication (check out the demo link of how to use css modules in the Technology Used section above)normaliz.css- (Necolas's)[https://necolas.github.io/normalize.css/] CSS normalize
Webpack configuration inspired by Jason Seminara's React To Do Application