Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • F FastAPI
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Sitemule
  • Public
  • workshops
  • open source on IBM i
  • FastAPI
  • Wiki
  • Part 2a. Extending my first service

Part 2a. Extending my first service · Changes

Page history
Update Part 2a. Extending my first service authored Oct 29, 2021 by Jens Melgard Churchill's avatar Jens Melgard Churchill
Hide whitespace changes
Inline Side-by-side
Part-2a.-Extending-my-first-service.md
View page @ 86eb8b36
# Organising our files
You are doing great and as we'll soon see, the possibilities are out of bounds.
But first let's make sure we are all on the same page.
Run `git checkout -f Step-1` everyone should now be at the same PTF level...
## Time for some action, just a fraction of friction
If your not used to working in a bash shell, this might seem overly complicated,\
and if you've never used vim before, it might be downright terrifying!
The branch you just pulled will try and alleviate it the pain, taking us from grit 80 sandpaper to (hopefully) very little friction.
Try and list the folder content, by typing `ls -la` ...
You'll note a lot of new files have appeared, of note are:
* _requirements.txt_\
This file lists the packages our project requires, and their expected version.\
So instead of pip installing everything, we'll run simply run `pip install -r requirements.txt` and it will install what ever is needed.\
You can create this fill, by getting pip to list all dependencies in your project, and saving it to the requirements file.\
Simply run `pip freeze >requirements.txt`
* _start.sh_\
Going forward, we don't want to bother with all this installing, running, backgrounding and stopping nonsense.\
The bash shell-script `start.sh` will handle all the pain.\
If there is no virtual environment, it will create it, install the required packages (using the above file),\
test if the FastAPI service is running, and depending on what is required start or restart it.
* _stop.sh_\
The bash shell-script `stop.sh` will stop the service if it is running, it is used by `start.sh`, and in general we should have to worry about it.
* _view.sh_\
Running the service in the background is nice, but if we ever want to inspect what the service is doing `view.sh` will display the log of the service
* _.vimrc_\
Finally, we've added some configuration to vim, to make things a little more enjoyable here as well.\
First up, line-numbers and syntax highlighting, which should improve on legibility\
Second, we've bound **F5** to the `start.sh` script, so now updating packages and restarting the service is as simple as pressing **F5**.
## Before we start adding stuff, lets introduce some timestamps, everyone loves timestamps!
\ No newline at end of file
Clone repository
  • Part 1a. My first service
  • Part 1b. Testing my first service
  • Part 2a. Extending my first service
  • Part 2b. Organise my first service
  • Part 3a. Review my first service
  • Part 3b. Connecting my first service
  • Home