Files
sweet/docs/project-structure.md
T
Luca Casonato 3bce2fb8d3 feat: deployctl is not needed anymore (#45)
Deno Deploy now supports Deno.listen and Deno.serveHttp.
2021-07-30 14:09:04 +02:00

1.2 KiB

Project strcture

Initalizing a fresh project will generate multiple files. For now the most important files are main.ts, routes.gen.ts, and the pages and api routes in the pages subfolder.

The main.ts file is the entrypoint to your project. It is the file you link in Deno Deploy, or run locally with the deno CLI.

The routes.gen.ts file is a manifest of all pages and api routes in a project. When moving around or creating new pages, this file needs to be updated. This is done automatically when you run the fresh routes command. You never have to edit this file manually.

The files in the pages subfolder describe the HTML pages and API endpoints of your application. Files inside the pages/api subdirectory are treated as API routes, while all other files are treated as possibly dynamic HTML pages. More info about how the pages subfolder works can be found on the file system routing page.

Finally there is a deps.ts and api_deps.ts. These files are the central location for all external imports. The deps.ts file is used for runtime dependencies (ones that are used both on the server and on the client), and the api_deps.ts file is used for server only dependencies (for example ones used in API routes).