- Create an
.env
file on theserver
directory - Follows the
.env-example
structure
DB_URI=
SESSION_SECRET=
NODE_ENV=development
DOMAIN=http://localhost:3000
- set
DB_URI
to your local datbase- i.e
mongodb://localhost:27017/<name-of-db>
- or a cloud connection string, i.e mongodb atlas
- i.e
- set
SESSION_SECRET
to a random string of your choice
- I am using
yarn
but can also usenpm
- in a terminal window in the root directory then run
cd server
- then run
yarn
ornpm i
- then open another terminal window in the root directory then run
cd client
- then run
yarn
ornpm i
- To populate your Database with example data
- Open a terminal in the root directory and navigate to the server folder
cd server
- Then run the command
yarn populateDb
ornpm run populateDb
- This will populate all the relevant collections with data
- To run the server, open a terminal in the root directory and navigate to the
server
foldercd server
- Then run
yarn dev
ornpm run dev
- In the terminal you should see
🚀 Server is running on port 8000
Connected to DB
- The graphQL playground should be available on
http://localhost:8000/graphql
- A quick query to ensure that is working is to run
query GetAllPortfolios {
portfolios {
title
}
}
- To run the client, open a terminal in the root directory and naviagte to the
client
foldercd client
- Then run
yarn dev
ornpm run dev
- In the terminal you should see
ready - started server on http://localhost:3000
event - compiled successfully
- In your browser of choice, navigate to
http://localhost:3000/
- To login as an admin user
- navigate to
http://localhost:3000/login
- Fill in the login inputs as follows;
- Email
admin@admin.com
- Password
123456
- Email
- Login as an admin user
- Once logged in, click on the
Manage
dropdown in the Navigation and selectDashboard
- Now reload the page
- You get redirected to
http://localhost:3000/login?message=NOT_AUTHENTICATED
- This seems to occur because in the
withAuth
fileuser
is not returned in thereq
object