I hereby claim:
- I am pantharshit00 on github.
- I am pantharshit00 (https://keybase.io/pantharshit00) on keybase.
- I have a public key ASCKJQBTqUkSNmSY6mM8omII1h3s1ci1YR8cTH5yav42Cwo
To claim this, I am signing this object:
| import { PrismaClient } from "@prisma/client"; | |
| import slugify from "slugify"; | |
| async function main() { | |
| const prisma = new PrismaClient(); | |
| prisma.$use(async (params, next) => { | |
| // Manipulate params here | |
| if (params.model == "Project" && params.action == "create") { | |
| params.args.data.slug = slugify(params.args.data.name); |
I hereby claim:
To claim this, I am signing this object:
| /** | |
| * To get started install | |
| * express bodyparser jsonwebtoken express-jwt | |
| * via npm | |
| * command :- | |
| * npm install express body-parser jsonwebtoken express-jwt --save | |
| */ | |
| // Bringing all the dependencies in | |
| const express = require('express'); |
| import express from 'express'; | |
| import {renderToString} from 'react-dom/server'; | |
| import React from 'react'; | |
| import Component from './react-router.jsx'; | |
| import {StaticRouter as Router} from 'react-router-dom'; | |
| const app = express(); | |
| function template(data){ | |
| return ` |
| { | |
| "name": "testPassport", | |
| "version": "1.0.0", | |
| "description": "Simple auth app", | |
| "main": "app.js", | |
| "author": "Harshit Pant", | |
| "license": "MIT", | |
| "dependencies": { | |
| "body-parser": "^1.17.1", | |
| "express": "^4.15.2", |
| // Using express as a server | |
| const express = require('express'); | |
| const morgan = require('morgan'); // JUST FOR LOGS | |
| const session = require('express-session') // for sessions | |
| const bodyParser = require('body-parser') // for req.body | |
| const passport = require('passport'); | |
| const LocalStrategy = require('passport-local').Strategy; | |
| const User = require('<relative path to User.js eg ./User>') // Use relative path to the User file |
| const Sequelize = require('sequelize'); | |
| const connection = new Sequelize('<db name here>','<db username here>','<db passworfd here>',{ // Defining our connect by Sequelize constructor | |
| host: '<db host here eg localhost, db.example.com, 127.0.0.1 >', | |
| dialect: 'postgres' // According to which dbms you are using | |
| }) | |
| const User = connection.define('users',{ | |
| id:{ | |
| type: Sequelize.INTEGER, // All dataTypes format available here http://bit.ly/2ofwgAm |
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import {BrowserRouter as Router,Link,Route} from 'react-router-dom'; | |
| export default class App extends React.Component{ | |
| render(){ | |
| return( | |
| <Router> | |
| <div> | |
| <ul> |