
About Lovia » Backend API Development
261 FOLLOWERS
Our blog contains news, tips, updates, and anything related to backend development. We provide services from personal life counseling to career development and engineering.
About Lovia » Backend API Development
2y ago
In Strapi website, when installing Strapi using Docker, the available guide only tells you how to create a brand new Strapi app. On the other hand, they do not give a step-by-step guide how to build your Strapi app image from an existing project
In this article, we are going to learn how to create a Docker image from your existing Strapi app ! Here is the Github Repository that I use in creating this article, you may want to check it out while reading this. Without further do, let’s get started
Github Repository : https://github.com/kevinadhiguna/strapi-dockerize
Step 1 : Create a Dockerfile ..read more
About Lovia » Backend API Development
2y ago
Strapi contains a feature in which anonymous and otherwise non-sensitive data is collected. Like any other software, the main aim is to provide the best experience to users.
“ What data is collected ? “
Unique project ID (generated with UUID)
Unique machine ID (generated with node-machine-id)
Environment state (development, staging, production)
System information (OS)
Build configurations
Of course, no personal data is collected and any data collected is secured, encrypted and anonymized. Please check official docs to understand more.
“ How do I disable Telemetry in Strapi ? ”
Simply, please ..read more
About Lovia » Backend API Development
2y ago
From our previous blog in making a register page with React js + Ant Design (see.. https://about.lovia.id/3-easy-step-to-create-signup-form-with-ant-design-reactjs/), for now we’re gonna connect it to our Strapi Backend and make it functional. The frontend is using the miluv-pwa repository and the backend is using lovia-profile repository. The core thing that we need to do is we have to make a function inside of the register and login page that contains a post query to Graphql API in Strapi. To look for query documentation, you can go to http://localhost:1337/graphql (Strapi’s API) and you can ..read more
About Lovia » Backend API Development
2y ago
In this blog, we will discuss how to make a Mutation on Graphql to Create and Modify a user. We only gonna modify 2 files, user.service and user.resolvers
user.service
user.resolver
Mutation: Create User user.service
We will create one function here to create a user, we’ll name it ‘createUser(userData)‘. We have one parameter here containing all of our input data that required to create a user. the example of our input data is slug, name, and email. The main code here is to create a document inside of our user. That will be done by one block of code of Typeorm
<yourUserRepository>.in ..read more
About Lovia » Backend API Development
2y ago
In this blog, we will discuss how to make a query to fetch one user by id. This’s very simple. We only gonna modify 2 files, user.service and user.resolvers
user.service
user.resolver
user.service
We’ll make one function with just one line of code. The code is simply finding our expected user in our database. With Typeform, the code will basically look like:
<your-user-repository>.find({where: {id: <inputedID>}});
This is our example of the complete function:
async findOne(id: number): Promise<User> { return await this.userRepository.findOne({ where: { _id: id ..read more
About Lovia » Backend API Development
2y ago
What is CORS ?
CORS stands for Cross-Origin Resource Sharing. According to developer.mozilla.org, Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. Simply, it is a web application security feature in a browser.
Image below shows how CORS is implemented :
Image : developer.mozilla.org
We can see that domain-a.com contains an image from domain-b.com. However, of course the image from domain-b.com is not stored in the web server of domain-a.c ..read more
About Lovia » Backend API Development
2y ago
Installation for MongoDB locally on windows computer
Download Mongodb
Download MongoDB here. Choose the MongoDB Community Server.
Run the Installer
Just click next..
Edit Path
Edit your environment variable in System Properties. Edit path variable on your User Variables. Add The MongoDB’s Bin folder, usually in C:\Program Files\MongoDB\Server\4.2\bin
Run MongoDB
$ mongod
$ mongo
To use MongoDB, you can use it from MongoDB Shell. Run Mongo
CRUD for MongoDB Compass
First Step: Make a local connection. Type mongodb://localhost
The rest of it y ..read more
About Lovia » Backend API Development
2y ago
Strapi is an amazing open source headless CMS that enables developers to design API fast. It is very developer-friendly and based on my experience, it also helps developers to finish tasks in minutes, which normally costs several hours.
In Strapi official website, you can see some active Strapi communities.
Unfortunately, my country was not on the list:(
So, I tried to ask the Strapi Team to create a Strapi community in my country, Indonesia. At first, I was confused and had no idea about it. As a result, I joined a Strapi group on Slack, as listed on its website.
There were several channels ..read more
About Lovia » Backend API Development
2y ago
Strapi GraphQL series is back! In the previous post related to Strapi and GraphQL, in a project named id-card-repository I did CRUD operations without being authenticated which is dangerous enough as it enables all users (public users) to modify data.
Today, I would like to implement authentication and authorization so only authenticated users can conduct CRUD operations. However, this article may not cover Media (Image) data type.
— Continuing development using Strapi —
First, open Command Line Interface (CLI) and change the directory to the id-card-repository folder by typing :
$ cd id-card ..read more
About Lovia » Backend API Development
2y ago
Have you ever heard of API? API stands for Application Programming Interface. As mobile applications became popular nowadays, the use of API also became a standard. For example, if a company has a website and a mobile application (both Android and iOS), they are not going to create separate databases. Instead, they use API to fetch data from their database, so the website and the application is synchronous.
— Brief History —
According to Devathon, REST APIs or RESTful API which stands for REpresentational State Transfer API was invented in 2000 by Roy FIelding and is often used since its appea ..read more