mirror of
https://github.com/filiprojek/nork.git
synced 2025-02-20 01:22:58 +01:00
nork create projectName -> done
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { Request, Response } from 'express'
|
||||
|
||||
const root_get = (req: Request, res: Response) => {
|
||||
res.render('home')
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
root_get,
|
||||
}
|
||||
|
@@ -0,0 +1,10 @@
|
||||
import { Router, Request, Response, NextFunction } from 'express'
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.use((req: Request, res: Response, next: NextFunction) => {
|
||||
console.log('Hi :)')
|
||||
next()
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
|
17
src/make-files/express-ts/model.js
Normal file
17
src/make-files/express-ts/model.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const mongoose = require('mongoose')
|
||||
const Schema = mongoose.Schema
|
||||
|
||||
const modelSchema = new Schema(
|
||||
{
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
},
|
||||
)
|
||||
|
||||
const ModelName = mongoose.model('ModelName', modelSchema)
|
||||
module.exports = ModelName
|
@@ -0,0 +1,8 @@
|
||||
const { Router } = require('express')
|
||||
const rootController = require('../controllers/rootController')
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.get('/', rootController.root_get)
|
||||
|
||||
module.exports = router
|
||||
|
9
src/make-files/express-ts/test.js
Normal file
9
src/make-files/express-ts/test.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const { getReq, getRes } = require('./modules/reqRes.module.js')
|
||||
const { root_get } = require('../controllers/rootController.ts')
|
||||
|
||||
test('Home page render test', () => {
|
||||
const req = getReq()
|
||||
const res = getRes()
|
||||
|
||||
expect(root_get(req, res)).toBe(true)
|
||||
})
|
15
src/make-files/express-ts/view.ejs
Normal file
15
src/make-files/express-ts/view.ejs
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>New Project</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user