squishy123 / ronin-starter Goto Github PK
View Code? Open in Web Editor NEWRonin Framework Starter
License: GNU Affero General Public License v3.0
Ronin Framework Starter
License: GNU Affero General Public License v3.0
Custom Node.js Server with the following features
"scripts": {
"dev": "cross-env NODE_ENV=development nodemon --exec babel-node src/server/server.js",
"format": "prettier --write \"./**/*.{js,jsx,json}\"",
+ "test": "jest"
},
+ "nodemonConfig": {
+ "verbose": false,
+ "ignore": [
+ "tests/*"
+ ]
+ },
+ "jest": {
+ "transform": {}
+ }
In file: tests/routes/users/loginUser.test.js
const fetch = require('node-fetch');
//${process.env.SERVER_URL}:${process.env.SERVER_PORT}
async function loginUser(username, email, password) {
return await fetch(`http://localhost:3000/user/login`,
{
method: 'POST',
body: {
username, email, password
}
}).then(res => res.json());
}
test(`all null values`, () => {
return loginUser(null, null, null).then(data => {
console.log(data);
expect(data).toStrictEqual({
message: "Error: Missing required parameter username/email and password"
});
})
});
*NOTE: Jest runs files containing the string test in its name
function packageMiddle(middle) {
return async function (req, res, next) {
+ try {
await middle(req, res);
if(next)
next();
+ } catch(err) {
+ res.status(400).send(err);
+ }
};
}
function packageMiddle(middle) {
return async function (req, res, next) {
+ await middle(req, res);
- middle(req, res);
if(next)
next();
};
}
Currently the ronin-starter uses basic console logging for verbose messages such as:
Since console.log is a synchronous process, large amounts of logging can decrease the performance of the server. Additionally there needs to be a better system to log messages to a file for archival purposes and also in the event of a server failure.
Implementation of a better debugging system is desireable:
Possible Library Inclusions:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.