I posted a while ago a short article expressing my desire to do some open-source projects.
While I've been using the time to publish some stuff on my GH page, now I believe I'm finally ready to start working on my idea.
If only I knew where to start...
I want to create an application where the user uploads a code bar from a soft-drink bottle, the code is translated to a string, the image discarded and based on the string some queries on the DB.
This is the short version of it. The front-end can be anything, but I will probably go for Gatsby or Gridsome.
For the back-end, I just need some easy API where I can create some CRUD entities, do some queries (POST / GET) and throw a json back.
Here are my questions:
What would be the easiest way to create such an API, host and deploy it? I was thinking of a Graphql API on NodeJs. (mostly because it looks like something fun to learn). But I have no experience creating a full API back-end.
How can I upload an image "somewhere", fetch the barcode string from it and then discard it? (I have no use to save it)
Any advice on how to plan all these and get started would be greatly appreciated.
Latest comments (4)
I would suggest, go with REST like Express.js instead of GraphQL because unless you have a lot of returning data and you want to handle it based on device type to solve over-fetching or under-fetching issues and you also have file upload and file management so it would also good to use REST APIs, it will have good performance
but if you want to learn GraphQL then go-ahead
The absolute easiest way to put together a quick CRUD MVP would be to use the OpenAPI spec to generate a backend stub (github.com/OpenAPITools/openapi-ge...).
You can use OpenAPI to generate the application structure of your backend in dozens of supported languages and frameworks. Then you just need to fill the stubbed files and methods with functionality.
When you "upload" an image through the HTML form, it typically creates a temporary file on the filesystem of the server backing the form. That file is then made available to your application to do something with. By default, the image is usually discarded, if you don't explicitly move or copy it from the temporary directory (/tmp, for example on Linux servers), then the server will naturally clean it out as needed periodically.
Thank you for your response.
Isn't OpenAPI doing something similar to strapi.io?
No. OpenApi is not software.
It's a design standard for documentation of how APIs work. However, it's evolved now to work backwards to generate code from that documentation.
Essentially, you describe what you want your api to do: method, input, response, type URL path, etc.
Once youre done describing all of the apis you need, you can feed them into any number of code generation tools that support openapi, and it will bootstrap your application for you in any number of supported languages.
You then fill out the rest.