![]( ![]( ![]( ![]( ![](

Routjes is an Elixir library that can extract Phoenix router paths and create a java/typescript module of them.

Routjes is a Dutch / English word. In Dutch there is an habit of referring to normal things as small, we do this by adding 'tje' to the object.
Coincidentally you pronounce Routjes the same as your would in English as "Route JS".

## Getting started

defp deps do
  [  {:routjes, "~> 1.0.0"},  ]

## Settings

Routjes requires a small configuration in your config.exs:

config :routjes,
  output_dir: __DIR__ <> "/../assets/js",
  output_file: "routjes.ts",
  router: MyApp.Web.Router,
  end_point: MyApp.Web.Endpoint

## Plain Javascript or Typescript
I'd highly recommend to let Routjes generate a typescript source file. You can enable this by making sure the output_file config setting carries the .ts extension.
If you do prefer to use a plain vanilla javascript source file, then ensure the output_file config setting carries the .js extension.

### Usage
Routjes can generate the (type|java)script source files by invoking the mix task :
`mix routjes.generate`

If you like you can also call the function directly by using :

If the configuration is successful you will now have your routes available in js :)
An example looks like :

    import Routjes from './routjes'


    Routjes.ProjectTaskShow({project_id: 1, id: 1})

    Routjes.ProjectTaskShow({project_id: "my-project", id: 7}, {foo: "bar", baz: true}).url

All routes are made into functions to help with autocomplete.

## License

The Routjes Elixir library is released under the DWTFYW license. See the LICENSE file.