Using ES Modules

This commit is contained in:
Daniel Hutzel
2024-07-16 15:29:45 +02:00
parent 7a2e345cd5
commit cba8e0cc5c
12 changed files with 25 additions and 37 deletions

View File

@@ -1,6 +1,7 @@
{
"name": "@capire/hello-world",
"version": "1.0.0",
"type": "module",
"scripts": {
"test": "npx jest --silent",
"start": "cds-serve srv/world.cds",

View File

@@ -1,7 +1,6 @@
module.exports = class say {
hello(req) {
let {to} = req.data
if (to === 'me') to = require('os').userInfo().username
import cds from '@sap/cds'
export class say extends cds.ApplicationService {
hello (to = 'World') {
return `Hello ${to}!`
}
}

View File

@@ -1,7 +1,6 @@
import { Request } from "@sap/cds"
module.exports = class say {
hello(req: Request) {
return `Hello ${req.data.to} from a TypeScript file!`
}
import cds from '@sap/cds'
export class say extends cds.ApplicationService {
hello (to : String = 'World') {
return `Hello ${to} from TypeScript!`
}
}