Skip to content

Commit c66b474

Browse files
committed
initial commit
0 parents  commit c66b474

23 files changed

+18180
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/frontend/node_modules
5+
/frontend/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/frontend/coverage
10+
11+
# production
12+
/frontend/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Setup
2+
If not already installed, please install the following:
3+
1. Go ([install instructions](https://go.dev/doc/install))
4+
2. Node ([download page](https://nodejs.org/en/download))
5+
6+
We have tested this with Node 20. You may have issues if you try to use a different version
7+
8+
# Running
9+
Open two separate terminals - one for the React app and one for the golang API
10+
11+
## Golang API
12+
1. In the first terminal, change to the backend directory (`cd backend`)
13+
2. Run `go run main.go` to start the API server
14+
15+
This must be running for the frontend to work
16+
When you make a change, you must stop the server (`ctrl-c` in the terminal), and restart it with `go run main.go`
17+
18+
## React App
19+
1. In the second terminal, change to the frontend directory (`cd frontend`)
20+
2. Run `npm start` to start the React app server
21+
3. If it doesn't open automatically, open [http://localhost:3000](http://localhost:3000) to view your website
22+
23+
Leave this running. It will automatically update when you make any changes

backend/go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module my-project
2+
3+
go 1.20

backend/main.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import "net/http"
4+
5+
func main() {
6+
// Your code here
7+
}
8+
9+
func ToDoListHandler(w http.ResponseWriter, r *http.Request) {
10+
w.Header().Set("Access-Control-Allow-Origin", "*")
11+
12+
// Your code here
13+
}

backend/openAPI.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
openapi: 3.0.3
2+
info:
3+
title: SparkLayer Coding Test
4+
version: 1.0.11
5+
6+
paths:
7+
/:
8+
post:
9+
summary: Add a To-Do to the list
10+
operationId: createToDo
11+
requestBody:
12+
description: Create a new To-Do Task
13+
content:
14+
application/json:
15+
schema:
16+
$ref: '#/components/schemas/To-Do'
17+
required: true
18+
responses:
19+
'200':
20+
description: Successful operation
21+
content:
22+
application/json:
23+
schema:
24+
$ref: '#/components/schemas/To-Do'
25+
'400':
26+
description: Invalid input
27+
get:
28+
summary: Gets the To-Do List
29+
operationId: getToDo
30+
responses:
31+
'200':
32+
description: successful operation
33+
content:
34+
application/json:
35+
schema:
36+
$ref: '#/components/schemas/To-Do-List'
37+
components:
38+
schemas:
39+
To-Do-List:
40+
41+
additionalProperties: false
42+
type: array
43+
items:
44+
$ref: '#/components/schemas/To-Do'
45+
To-Do:
46+
required:
47+
- title
48+
- description
49+
properties:
50+
title:
51+
type: string
52+
example: Go for a jog
53+
description:
54+
type: string
55+
example: run 4km around the river

frontend/README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `npm run build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `npm run eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35+
36+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39+
40+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).

0 commit comments

Comments
 (0)