Sanic: Add example code details to Documentation

Created on 6 Nov 2018  路  12Comments  路  Source: sanic-org/sanic

Describe the bug
Currently, we have a lot of examples of different use cases in sanic. However, it's missing from the Documentation.

Code snippet
NA

Expected behavior
It will be good if we can have a reference to each of the example code with some brief description in the Documentation section so that everything can be found under a common roof.

Environment (please complete the following information):
NA

Additional context
NA

Documentation - To Do

  • [ ] Review and include any missing sections of the changes into Documentation post the current LTS release
  • [ ] Examples
  • [ ] Tutorials
  • [ ] API Definitions
  • [ ] Some enhancement to Contribution guidelines to include PR process and Commit guidelines. (i.e. Commit message format guideline. Would be easy to auto-generate a Change Log eventually.)
  • [ ] Some details about Release Versioning and the upcoming release schedules (if available)
documentation necessary

All 12 comments

Examples and a "tutorial" was something I have been wanting to add to a beefed up home page and documentation. After this next release I am hoping we can get a few people working together to make a big push on this effort. Care to help?

@ahopkins Yes. I'm always game for documentation. I also noticed that some of the APIs are missing documentation that needs to be included.

@ahopkins I added a few items under the checkbox to track the things that need to go into Documentation update. Please feel free to update it as applicable.

Will do. @sjsadowski... want to add this to the project board?

@ahopkins @harshanarayana I've been thinking about building out examples but I'd like a little clarity.

Would it be better to showcase connecting to a low-level db using an async driver, or would it be better to incorporate a few examples that users would likely be using - like asyncpg?

@LBWright it's better to keep the examples as exhaustive as possible. Both items you mentioned has its own advantage but caters to two different level of audiences. So, why limit when we add examples? We add both and let the end user decide which one they want to use.

Sounds good! I just wanted to make sure I had permission to start libraries into my examples.

@LBWright we sure need any kind of example possible, from the simplest "hello world" to advanced asyncio hacks and integrations. If you look at what has been asked in the issues so far, gitter and in the community forums, you would be surprised on the variety of topics :wink:

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is incorrect, please respond with an update. Thank you for your contributions.

Looking at the recent posts in community forum, I found some examples with different use cases, and I think it would be nice to have in Documentation:

  1. Sanic with Celery
  2. Asyncio's queue in Sanic
  3. Deployment on AWS with Docker
  4. Sanic as a proxy with aiohttp
  5. Issue with NginX
  6. Sanic as a cronjob

Some more examples with ORM:

  1. PostgreSQL - GINO added support for Sanic
  2. MongoDB - Motor

    • Related discussion on Github

The first feeling I get of that list of things that none of them are strongly related to Sanic and will definitely be better documented elsewhere.

One thing that bothered me when coming to Sanic is the mention of deployment with daphne, uvicorn and hypercorn but no tips on which to use, or if this even has any benefits over the built-in server.

The new sanic-guide repo (that houses the Sanic frontpage) has a section for this. Over the next few months, I hope to fill that out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

1067511899 picture 1067511899  路  3Comments

eseglem picture eseglem  路  4Comments

geekpy picture geekpy  路  4Comments

fiecato picture fiecato  路  3Comments

graingert picture graingert  路  3Comments