# Return urmodule as a string without writing a file

**URL:** <https://racket.discourse.group/t/return-urmodule-as-a-string-without-writing-a-file/3115>\
**Category:** Questions & Answers\
**Tags:** urlang, web\
**Created:** [August 20, 2024, 9:05pm UTC](https://racket.discourse.group/t/return-urmodule-as-a-string-without-writing-a-file/3115 "2024-08-20T21:05:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nik](https://avatars.discourse-cdn.com/v4/letter/n/6de8d8/32.png) [@nik](https://racket.discourse.group/u/nik)\
**Post date:** [August 20, 2024, 9:05pm UTC](https://racket.discourse.group/t/return-urmodule-as-a-string-without-writing-a-file/3115/1 "2024-08-20T21:05:01Z")

</div>

I was wondering whether it's possible to use urlang in such a way that the content of the module is simply returned, instead of writing it out to a file. That way I suppose it could be combined to insert some javascript (via urlang) into an html template.

Is that something that is already possible? It strikes me as a thing that is almost implemented already with `current-urlang-echo?`.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [August 21, 2024, 12:51am UTC](https://racket.discourse.group/t/return-urmodule-as-a-string-without-writing-a-file/3115/2 "2024-08-21T00:51:59Z")

</div>

Hi @nik

I have now added `urlang/string`.  
Wrap `urlang/string` around some some `(urmodule ...)` and you will  
get a list back consisting of module names and strings with the JavaScript.

Example:

```scheme
#lang racket
(require urlang)

(urlang/string
 (urmodule demo-fact                                      
   (export fact)                                          
   (define (fact n) (if (= n 0) 1 (* n (fact (- n 1)))))
   (console.log (fact 5))))

```

Result:

```scheme
'((demo-fact "\"use strict\";\nfunction fact(n){return (((n===0)===false)?(n*(fact((n-1)))):1);};\n((console.log)((fact(5))));\nexport {fact};"))

```

---

<div class="post-metadata">

**Author:** ![nik](https://avatars.discourse-cdn.com/v4/letter/n/6de8d8/32.png) [@nik](https://racket.discourse.group/u/nik)\
**Post date:** [August 21, 2024, 7:10am UTC](https://racket.discourse.group/t/return-urmodule-as-a-string-without-writing-a-file/3115/3 "2024-08-21T07:10:21Z")

</div>

Oh nice, that's really cool! Thank you for the quick response/solution! 🙂
