Now that you've created your first endpoint, it's time to see it in action! Revali's development server makes it incredibly easy to run and test your API.
Starting the Development Server#
From your project root, run:
dart run revali dev
This single command does everything you need:
- ✅ Compiles your Dart code
- ✅ Generates server files
- ✅ Starts the HTTP server
- ✅ Enables hot reload for instant updates
Testing Your API#
Your First API Call#
Open your browser and navigate to your endpoint:
http://localhost:8080/api/hello
You should see:
"Hello, World!"
🎉 Congratulations! Your API is working!
Understanding the URL Structure#
- Base URL:
http://localhost:8080 - API Prefix:
/api(automatically added) - Controller Route:
/hello(from your@Controller('hello')) - Method Route: Empty (from your method name
Get()) - Full URL:
http://localhost:8080/api/hello
Understanding Generated Files#
Revali automatically generates server files in the .revali directory:
.revali/
└── server/
├── server.dart # Main server entry point
├── routes/ # Routes definitions
│ └── __hello_route.dart # Hello controller
└── ... # Other generated files
Development Workflow#
Hot Reload Magic#
One of the best features of Revali's development server is hot reload:
- Make changes to your controller
- Save the file (Ctrl+S / Cmd+S)
- See changes instantly - no restart needed!
Try it now:
- Change the return value in your
hello()method - Save the file
- Refresh your browser
- See the new response immediately!
Stopping the Server#
To stop the development server:
- Press
q(orCtrl+C) in the terminal - The server will shut down gracefully
Troubleshooting#
Common Issues#
Server won't start?
- Check that all dependencies are installed:
dart pub get - Ensure you're in the project root directory
- Look for error messages in the terminal
Can't access the API?
- Make sure the server is running (you should see the startup message)
- Check the URL - it should be
http://localhost:8080/api/hello - Try a different browser or clear your browser cache
Changes not reflecting?
- Ensure hot reload is working
- Try stopping and restarting the server
- Check for syntax errors in your Dart code
Getting Help#
If you run into issues:
- Check the terminal output - Revali provides detailed error messages
- Verify your code - Make sure your controller follows the naming conventions
- Restart the server - Sometimes a fresh start helps
- Check the documentation - Each component has detailed guides
What's Next?#
Your server is now running! Here are some next steps to explore:
Immediate Next Steps#
- Add more endpoints - Try different HTTP methods and routes
- Add parameters - Learn how to handle query parameters and path variables
- Return complex data - Try returning objects and lists
- Access Control - Learn how to control access to your endpoints
Production Deployment#
- Environment configuration - Set up different environments
- Monitoring - Add logging and metrics
Pro Tips#
Ready to build something amazing? Your development environment is set up and ready to go!