Code Monkey home page Code Monkey logo

Comments (4)

Lloople avatar Lloople commented on June 13, 2024 1

@hsharghi I pushed a commit regarding this feature, feel free to suggest any change via pull request as before 🙂

Still investigating the tests topic, not easy for me since I'm new to both Swift and Vapor 😅

from vapor-maker-commands.

Lloople avatar Lloople commented on June 13, 2024

That would be enough for now, sure 👍

But I don't quite like that kind of controller, hiding routes inside the controllers is a pattern that prevents you to see your routes well organized in a single file.

I would like to have a flag for this, like vapor run make:controller PlayersController --boot and use a new BootController.stub.

What do you think about that?

from vapor-maker-commands.

hsharghi avatar hsharghi commented on June 13, 2024

I like the idea of having a flag for this kind of controller.
But I would like having a testable generated code for all kinds of controllers too.

I don't think there is a single preferred approach for defining routes in Vapor as it's for Laravel.

I think creating single routes file for each controller will bloat the project structure, What do you think about adding routes to routes.swift file?

from vapor-maker-commands.

Lloople avatar Lloople commented on June 13, 2024

The command can drop a message on how to add this bootable controller into the routes.swift file, I don't think the command should edit that file, it's beyond the scope of the project and also the user would like to order the routes or split them into separate files as they want.

I would like to have tests too! But first I need to figure out a way for my tests to detect the resources shared via Packages.swift. I tried adding the resources: [ .copy("Resources")] key to the testTarget but no luck 😅

from vapor-maker-commands.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.