Skip to content

Instantly share code, notes, and snippets.

View abel0b's full-sized avatar
🐉
Compiling

Abel Calluaud abel0b

🐉
Compiling
View GitHub Profile
@abel0b
abel0b / server.js
Created June 17, 2018 18:27
express api
import express from "express"
import ArticleController from "controller/ArticleController"
const app = express()
app.get("/articles", ArticleController.index)
app.get("/articles/create", ArticleController.create)
app.get("/articles/:slug", ArticleController.show)
app.get("/articles/:slug/edit", ArticleController.edit)
app.patch("/articles/:slug", ArticleController.update)
function (request, response, next) {
let html = ReactDOMServer.renderToString(React.createElement(
StaticRouter,
{
location: request.url,
context: {}
},
React.createElement(App)
));
response.send(`