npm run devto start the API with added dev dependency NODEMON.nodemon server/app.jsalternatively if you do have NODEMON installed in your machine globallynpm run testto run JEST/SUPERTEST on Login/Register/Validate routes- Validate Testing is Currently SKIP mode cuz you will need a valid and invalid token to test
test.restcan be used if you have VS Code ExtensitionREST Client: All Calls are currently working
- The server is configured to take the following structure:
- A nested Directory called "client"
- Directory should sit at same level as the "server" directory
- It is ready to serve the
index.htmlfrombuildfolder once its ready for deployment - This structure will give the ability to do a single repo deployment (which I can get going with Render.io)
- To tap into the routes, I suggest continuing using axios.
- In the Client
package.json, add aproxyproperty and set it tohttp://localhost:3002/ - That will allow all your API calls to be made like in the following example:
Example:
axios.get("/api/v1/login")
To run local test feel free to add this to a
.envIN THE ROOT of the project (same level as server directory)
DB_URI=your_mongodb_uri_without_quotes TOKEN_SECRET=anySecretStringWithoutQuotes
- Is currently expecting an Obj with the following properties:
- username
- password
Check test.rest to see the object being sent if in doubt =)
- Is currently expecting an Obj with the following properties:
- username
- password (email may be sent and will be ignored server side)
Check test.rest to see the object being sent if in doubt =)
- Is currently expecting a STRING being sent with HEADERS
Check test.rest to see the string being sent if in doubt =)
- Is a PUT request with Params
- Expects a username and a Product id
ex:
http://localhost:3002/api/v1/medic111111/cart/new/637d3d90d02308f12deffcf8
Check test.rest to see the call being sent if in doubt, and observe the response =)
- Is a PUT request with Params
- Expects a username and a Product id
- Will Remove x amount of items with that id
ex:
http://localhost:3002/api/v1/medic111111/cart/new/637d3d90d02308f12deffcf8
Check test.rest to see the call being sent if in doubt, and observe the response =)
I really hope this helps.