Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Random Survey API Endpoints #27

Open
benson-fm opened this issue Dec 6, 2024 · 0 comments
Open

Create Random Survey API Endpoints #27

benson-fm opened this issue Dec 6, 2024 · 0 comments
Assignees

Comments

@benson-fm
Copy link
Collaborator

Quote

  • We bring the BOOM!” - A.J. and Big Justice

Description

  • Your task is to create some of the tables that we will be using throughout the rest of this project.

Instructions

Setup

Before you can work on the repo, you need to add the secrets.

For the Frontend .env, put it in /client.
For the Backend .env, put it in /server.

You also need to add this file in /server/config

Task

Create the following API endpoints:

  • random survey

For a description of each of these endpoints, see the Project Architecture
Follow proper API conventions and return status codes along with your response. Namely 200, 404, 500, etc.
Put your endpoints into /server/routes/[FILENAME].js
Replace FILENAME with the name of the DB table that the endpoint is for.
Don't Forget: use the keysToCamel function, as seen in the sample users.ts file, to make the SQL keys into camel case

Some sample files have been provided.

Steps

  1. Create file for each endpoint (events)
  2. Create a router for this file (see examples)
  3. Import and place this router into /server/src/App.ts (see line 40)
  4. Create the functions for get/post/put (delete if specified)

Example

GET /users/:id
Place this into /server/routes/users.js
See users.ts for the best examples.

Notes

To test your implementation, you can use Postman like we have in the bootcamps.
If you put your endpoints in sample.js (for example only), then you will need to send requests to:
127.0.0.1:3001/sample/<your_endpoint> OR localhost:3001/sample/<your_endpoint>

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants