function sumTwo(n) {
let sum = n;
const f = function(n) {
sum += n;
return f;
}
f.toString = () => {
return sum;
};
return f;
}
constructor(recipeDetails: Details = { title: "", description: "", ingredients: [] }) {
for (let key in recipeDetails) {
(this[key as keyof Details] as Details[keyof Details]) = recipeDetails[key as keyof Details];
}
}
interface Details { title?: string, description?: string, ingredients?: RecipeIngredient[]}
router.post('/api/auth/sign-up', async (ctx, next) => {
const user = new UserModel({
['info.name']: ctx.request.body.username,
email: ctx.request.body.email,
password: ctx.request.body.password
});
await user
.save()
.catch(err => {
ctx.throw(403, "Cannot create user or user is already created!");
});
ctx.body = user;
await next();
});
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
entry: './app/public/javascripts/main.js',
output: {
filename: './bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /\.node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader",
options: { minimize: true }
}
]
}
]
},
node: {
fs: "empty"
},
plugins: [
new HtmlWebPackPlugin({
template: "./app/public/index.html",
filename: "./index.html",
inject: true
})
]
};