mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Remove obsolete 1.x APIs
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
export default function (params: any): Promise<{ html: string, globals?: any }> {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
// Here, you could put any logic that synchronously or asynchronously prerenders
|
||||
// your SPA components. For example, see the boot-server.ts files in the AngularSpa
|
||||
// and ReactReduxSpa templates for ways to prerender Angular and React components.
|
||||
//
|
||||
// If you wanted, you could use a property on the 'params.data' object to specify
|
||||
// which SPA component or template to render.
|
||||
|
||||
const html = `
|
||||
<h1>Hello</h1>
|
||||
It works! You passed <b>${ JSON.stringify(params.data) }</b>
|
||||
and are currently requesting <b>${ params.location.path }</b>`;
|
||||
resolve({ html });
|
||||
});
|
||||
};
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SpaServices.Prerendering;
|
||||
using Webpack.ActionResults;
|
||||
|
||||
namespace Webpack.Controllers
|
||||
{
|
||||
// This sample shows how you could invoke the prerendering APIs directly from an MVC
|
||||
// action result.
|
||||
public class FullPagePrerenderingController : Controller
|
||||
{
|
||||
private static JavaScriptModuleExport BootModule = new JavaScriptModuleExport("Clientside/PrerenderingSample")
|
||||
{
|
||||
// Because the boot module is written in TypeScript, we need to specify a webpack
|
||||
// config so it can be built. If it was written in JavaScript, this would not be needed.
|
||||
WebpackConfig = "webpack.config.js"
|
||||
};
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
var dataToSupply = new { nowTime = DateTime.Now.Ticks };
|
||||
return this.Prerender(BootModule, dataToSupply);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ namespace Webpack
|
||||
});
|
||||
|
||||
app.UseStaticFiles();
|
||||
loggerFactory.AddConsole();
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
@@ -44,6 +43,11 @@ namespace Webpack
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.ConfigureLogging(factory =>
|
||||
{
|
||||
factory.AddConsole();
|
||||
factory.AddDebug();
|
||||
})
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseKestrel()
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
<h1>Hello</h1>
|
||||
Hi there. Enter some text: <input />
|
||||
|
||||
<hr />
|
||||
See also: <a asp-controller='FullPagePrerendering'>Full-page prerendering example</a>
|
||||
|
||||
@section scripts {
|
||||
<script src="dist/main.js"></script>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user