mirror of
https://github.com/filiprojek/nork.git
synced 2024-11-23 01:01:04 +01:00
Drop support for javascript
This commit is contained in:
parent
03fbb74171
commit
4f52c37cb3
@ -21,8 +21,8 @@ export default class Create {
|
||||
message: `Pick the technology you're using:`,
|
||||
name: 'lang',
|
||||
choices: [
|
||||
{ name: 'Typescript', value: 'ts' },
|
||||
{ name: 'Javascript - DEPRECATED', value: 'js' }
|
||||
{ name: 'Typescript', value: 'ts' }
|
||||
//{ name: 'Javascript - DEPRECATED', value: 'js' }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1,8 +0,0 @@
|
||||
const root_get = (req, res) => {
|
||||
res.render('home')
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
root_get
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
const { Router } = require('express')
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.use((req, res, next) => {
|
||||
console.log('Hi :)')
|
||||
next()
|
||||
})
|
||||
|
||||
module.exports = router
|
@ -1,17 +0,0 @@
|
||||
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
|
@ -1,8 +0,0 @@
|
||||
const { Router } = require('express')
|
||||
const rootController = require('../controllers/rootController')
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.get('/', rootController.root_get)
|
||||
|
||||
module.exports = router
|
@ -1,9 +0,0 @@
|
||||
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)
|
||||
})
|
@ -1,15 +0,0 @@
|
||||
<!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>
|
@ -1,2 +0,0 @@
|
||||
APP_PORT = 8080
|
||||
DB_URI = 'mongodb://username:password@localhost:27017/database?authSource=admin'
|
107
src/skeletons/express-js/.gitignore
vendored
107
src/skeletons/express-js/.gitignore
vendored
@ -1,107 +0,0 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# package lock file
|
||||
package-lock.json
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"lang": "js"
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "project-name",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "src/app.js",
|
||||
"scripts": {
|
||||
"start": "node src/app.js",
|
||||
"dev": "nodemon src/app.js",
|
||||
"test": "jest"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^8.2.0",
|
||||
"ejs": "^3.1.6",
|
||||
"express": "^4.17.1",
|
||||
"mongoose": "^5.12.3",
|
||||
"morgan": "^1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "^27.0.6"
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
const express = require('express')
|
||||
const morgan = require('morgan')
|
||||
const mongoose = require('mongoose')
|
||||
const dotenv = require('dotenv').config()
|
||||
const cors = require('cors')
|
||||
const path = require('path')
|
||||
|
||||
const routes = require('./routes')
|
||||
const middlewares = require('./middlewares')
|
||||
|
||||
const port = process.env.APP_PORT || 8080
|
||||
const app = express()
|
||||
|
||||
// MongoDB
|
||||
const dbURI = process.env.DB_URI
|
||||
mongoose
|
||||
.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true })
|
||||
.then((result) => {
|
||||
console.log('connected to db')
|
||||
app.listen(port, () => {
|
||||
console.log(`server is running on http://localhost:${port}`)
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
// View engine
|
||||
app.set('view engine', 'ejs')
|
||||
|
||||
// Middlewares
|
||||
app.use(middlewares)
|
||||
app.set('views', path.join(__dirname, 'views'))
|
||||
app.use(express.static(path.join(__dirname, 'public')))
|
||||
app.use(cors())
|
||||
app.use(morgan('dev'))
|
||||
app.use(express.urlencoded({ extended: true }))
|
||||
app.use(express.json())
|
||||
|
||||
// Routes
|
||||
app.use(routes)
|
@ -1,8 +0,0 @@
|
||||
const root_get = (req, res) => {
|
||||
res.render('home')
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
root_get
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
const { Router } = require('express')
|
||||
const sayHiMiddleware = require('./sayHiMiddleware')
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.use(sayHiMiddleware)
|
||||
|
||||
module.exports = router
|
@ -1,10 +0,0 @@
|
||||
const { Router } = require('express')
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.use((req, res, next) => {
|
||||
console.log('Hi :)')
|
||||
next()
|
||||
})
|
||||
|
||||
module.exports = router
|
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 5.8 KiB |
@ -1,13 +0,0 @@
|
||||
const { Router } = require('express')
|
||||
const rootRoutes = require('./rootRoutes')
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.use(rootRoutes)
|
||||
|
||||
// 404
|
||||
router.use((req, res) => {
|
||||
res.status(404).send('E404')
|
||||
})
|
||||
|
||||
module.exports = router
|
@ -1,8 +0,0 @@
|
||||
const { Router } = require('express')
|
||||
const rootController = require('../controllers/rootController')
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.get('/', rootController.root_get)
|
||||
|
||||
module.exports = router
|
@ -1,9 +0,0 @@
|
||||
const { getReq, getRes } = require('./modules/reqRes.module.js')
|
||||
const { root_get } = require('../controllers/rootController.js')
|
||||
|
||||
test('Home page render test', () => {
|
||||
const req = getReq()
|
||||
const res = getRes()
|
||||
|
||||
expect(root_get(req, res)).toBe(true)
|
||||
})
|
@ -1,16 +0,0 @@
|
||||
module.exports.getReq = () => {
|
||||
const req = {}
|
||||
req.body = {}
|
||||
return req
|
||||
}
|
||||
|
||||
module.exports.getRes = () => {
|
||||
const res = {}
|
||||
res.locals = {}
|
||||
res.status = () => res
|
||||
res.json = () => res
|
||||
res.send = () => res
|
||||
res.render = () => res
|
||||
|
||||
return res
|
||||
}
|
@ -1 +0,0 @@
|
||||
# Folder for utils and other config files
|
@ -1,69 +0,0 @@
|
||||
<!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">
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
body {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
}
|
||||
.content {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-top: 5rem;
|
||||
flex-direction: column;
|
||||
}
|
||||
footer, .welcome {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.welcome {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
img {
|
||||
width: 200px;
|
||||
padding-top: 2rem;
|
||||
}
|
||||
footer {
|
||||
padding-bottom: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
.logos {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="welcome">
|
||||
<h1>Let's make something amazing!</h1>
|
||||
<div class="logos">
|
||||
<img src="/nodejs_logo.svg" alt="node.js logo">
|
||||
<img src="/expressjs.png" alt="express.js logo">
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<div class="author">
|
||||
<p>Made by </p><a href="http://www.filiprojek.cz">filiprojek.cz</a>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user