What is Serverpod?
Serverpod is an open-source, scalable app server, written in Dart for the Flutter community.
How does Serverpod works?
Before we dive into details, Let's see how Serverpod works.
1️⃣ Write Dart methods in Endpoints (Server)
2️⃣ Run this command, Serverpod will generate wrapper code
3️⃣ Use the same method in Flutter app (Flutter)
Once your are done developing on localhost, deploy your server on AWS and get public APIs to use in your production application.
So now you have got fair Idea What Serverpod can do and How it does that. Let's understand from scratch how you can write your own Backend with Serverpod.
Installations
Flutter and Dart.
That's the core. You probably have it already setup, if not get it here.
Docker.
Docker is used to manage server, Just Install and signup. Get it here
Serverpod CLI
Once you have configure above, run the following command in terminal
dart pub global activate serverpod_cli
Test installation by running this command
serverpod
You should see Serverpod help commands if everything is setup properly. 👍🏼
Create project with Serverpod
Run the following command to create new project, demopod is name of the project.
ⓘ Docker instance should be running to create the project. Name your project wisely because Serverpod is going to create three projects with suffix _client, _flutter and _server respectively.
serverpod create demopod
It may take couple of minutes if its your first project. Once the command is executed successfully you should have three projects created in root directory demopod.
Live API Example:
"You have spent 10814 day(s) on earth."
Here is a video discussing all the above in details 👇🏼
Comentarios