Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .env.example

This file was deleted.

20 changes: 0 additions & 20 deletions .eslintrc.cjs

This file was deleted.

42 changes: 10 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,16 @@ The flow of the application you build looks like this:
3. The user can then create movies once they have a valid token
4. The list of displayed movies will update as a user creates them

## Setting up

Take a little bit of time to familiarise yourself with the project structure - this exercise has both a front-end React
app (`src/client/`) *and* a back-end express API (`src/server/`) in it.

1. Fork this repository and clone the fork.
1. If you want to use the more challenging `freedom` branch, or the completely empty `empty` branch, remember to UNCHECK the checkbox for "Copy the
`main` branch only"

<img src="./assets/forking_screenshot.png" alt="forking screenshot" width=600></img>
2. Then, once you have cloned your fork of the repo, you can run `git checkout freedom` or `git checkout empty` in your terminal.
3. If you do not uncheck this box, then you will only be able to access the `main` branch.
2. Rename `.env.example` to `.env`
3. Edit the `DATABASE_URL` variable in `.env`, swapping `YOUR_DATABASE_URL` for the URL of your database
4. Run `npm ci` to install the project dependencies.
5. If you're using the main branch, we have already created the Prisma schema and migrations for you. Run `npx prisma migrate reset` to execute the
database migrations. Press `y` when it asks if you're sure.

## Instructions

- Run the app with `npm run dev` - this will open a React app in your browser *and* run the express server at the
same time. This is thanks to the `concurrently` package that we have included in this project.
- The frontend React app will run on Vite's default port, which is usually `5173` - check the terminal once you have
started the app to see what port it is running on.
- If you have other Vite apps running, then this port could be different.
- The server will run on port `4000` (as set in `.env.example` - remember to create your own `.env` file). If you need
to, you can change this by updating the `VITE_PORT` environment variable in your `.env`.
- Note: This environment variable is used in both the server and the client. Vite requires environment variables
to be prefixed with `VITE_`, so do not change the name! Read more about environment variables in Vite
[here](https://vitejs.dev/guide/env-and-mode.html#env-files).
- Work through each file in the `requirements` directory in numerical order. You can choose whether to work on the
Client or Server version of each requirement first, but you may find it easier to do Server first.
## Requirements

1. Both your backend _and_ your frontend must exist in this repo. We should be able to run them both together with a single command.
2. Must use React, Express and an SQL database. Everything else is fair game.
3. Good luck, have fun!

## Extension

1. Create an admin dashboard where admins can view and delete users.
2. Introduce a second type of auth. It should be a second option to the user, not a replacement for the original.

## Example solution

Expand Down
24 changes: 24 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginReact from 'eslint-plugin-react'

export default [
{
rules: {
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-react': 'off',
},
},
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
},
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.recommended,
]
20 changes: 10 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Movie Manager</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading