Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
mvc-webapp
Advanced tools
Readme
A simple framework for MVC web applications and RESTful APIs.
mkdir test-app
cd test-app
npm init
npm install mvc-webapp --save
mkdir -p application/models
mkdir -p application/controllers
mkdir -p application/views
mkdir -p application/public
At some point this will be automated by a script, for now, it will involve some keystrokes.
#!/usr/bin/env node
'use strict'
const webapp = require('mvc-webapp')
webapp.run({
applicationRoot: process.env.PWD,
listenPort: process.env.PORT || '3000',
sessionRedisUrl: process.env.REDISCLOUD_URL || undefined,
sessionSecret: process.env.SESSION_SECRET || 'NOT_SO_SECRET',
redirectSecure: true,
errorMiddleware: (err, req, res, _) => {
res.json({
status: err.status,
message: err.message,
stack: req.app.get('env') === 'development' ? err.stack : ''
})
}
})
The error handling can be customized to return plain JSON, HTTP codes or an EJS rendered page, your choice.
'use strict'
const express = require('express')
const router = new express.Router()
router.get('/', (req, res, _) => {
res.json({
status: 'OK',
data: null
})
})
module.exports = router
This should be familiar to any Express user. A special exception is made for the index.js controller file, this is mapped to the root / folder. Additionally, any routes inside that controller, get appended as a method.
In order to render the EJS view, invoke the view (file)name in the res.render call:
res.render('index', {
title: 'Homepage',
user: 'octopie'
})
Add the following file to the root folder and docker build:
FROM node:latest
WORKDIR /app
ADD . /app
RUN npm install
CMD ["npm","start"]
FAQs
A simple framework for MVC web applications and RESTful APIs.
The npm package mvc-webapp receives a total of 0 weekly downloads. As such, mvc-webapp popularity was classified as not popular.
We found that mvc-webapp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.