Method: Template::Nodejs.index

Defined in:
lib/souls/cli/create/templates/functions/nodejs/index.rb

.index(file_name) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/souls/cli/create/templates/functions/nodejs/index.rb', line 3

def self.index(file_name)
  "    const express = require('express');\n    const bodyParser = require('body-parser');\n\n    const app = express();\n    app.use(bodyParser.urlencoded({ extended: true }));\n\n    app.get('/souls-functions-get', (req, res)=>{\n      res.json(req.query)\n    });\n\n    app.get('/souls-functions-get/:id', (req, res)=>{\n      res.json(req.params)\n    });\n\n    app.post('/souls-functions-post', (req, res)=>{\n      res.json(req.body)\n    });\n    exports.\#{file_name.underscore.camelize(:lower)} = app;\n  APP\nend\n"