You can use npm
or yarn
for this repo. Newer Macbooks with the M1 chip should use yarn
.
Install Server Dependencies
yarn install
Install Client Dependencies
cd client/
yarn install
To start the server, run the following:
yarn run dev
- SQLite
The SQLite database is stored in a file locally.
The repository comes with the database pre-seeded. If you need to reset the database to its original state, run the following:
yarn run seed
This repository uses the sqlite3
npm package. In /db
, we already connect to the database file for you. Simply import /db/index.js
to the file in which you need it and start running queries.
For more information on how to use sqlite3
, read the docs here.
If needed for your coding challenge, you may change the structure of the database. One way you could accomplish this is by:
- Deleting the file
/db/test.db
- Changing the migration file (
/db/migrate.js
) - Running
yarn run migrate
- If necessary, change the seed file (
/db/seed.js
) and runyarn run seed
- Node
- Express
- sqlite3
The client is built using Create React App. The command listed above for starting the development server is enough to start the express server and Create React App.
To make server requests, simply make the request with a relative path. The requests should already be proxied from the client server port (3000) to the express server port (8080).
example:
// relative route
await fetch('/my/route/here');
/* AVOID DOING THIS */
// absolute route
await fetch('localhost:8080/my/route/here');
- React
- React Router