Category : routes

I want to upload a .csv file to my REST API server. The client has the following function: postFile() { var formData = new FormData(); formData.append("file", this.props.submittedFile) axios.post("http://localhost:1337/classify-csv", formData, { headers: { "Content-Type": "multipart/form-data", Authorization: "Bearer " + localStorage.getItem("token"), Email: localStorage.getItem("email") } }).then((response) => { ; }, (error) => { this.unmount(); }); } (no worries, ..

Read more

I’m trying to follow the basic examples on the Gatsby website. These are my codes so far: // pages/app.js import { Router } from ‘@reach/router’; import { Link } from ‘gatsby’; import * as React from ‘react’; import Browse from ‘../components/Browse’; import Upload from ‘../components/Upload’; const AppPage = () => ( <> <nav> <Link to ..

Read more

I made a react app with npx create-react-app. This is my app.js: import React, { Component } from "react" import { render } from "react-dom"; import HomePage from "./components/HomePage"; import { BrowserRouter, Switch, Route, Link, Redirect } from "react-router-dom" export default class App extends Component { constructor(props) { super(props); } render(){ return ( <BrowserRouter> <Switch> ..

Read more

I’m trying to figure out how to write an api route that handles deleting one entity without deleting the other. For instance, I’m working on an inventory project and I want the ability to delete a product without deleting the raw materials associated with it. These are my tables: product_materials = db.Table ( "product_materials", db.Column( ..

Read more